[Ada] Revamp analysis of conditional expressions
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 7 Feb 2022 10:44:29 +0000 (11:44 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Thu, 12 May 2022 12:38:36 +0000 (12:38 +0000)
commit49a31a140db31b1513d10af5bdc65fee046162fa
treec367903ecd5f0dd314399a52450a47a1819168c4
parent91d68769419b64ef9843c4c1eac5261217693b1e
[Ada] Revamp analysis of conditional expressions

The current implementation is skewed toward the first dependent
expression and does not look into the interpretations of the others if
the first one is not overloaded, which can create spurious ambiguities.
And more precise error messages are now given if the types of the
dependent expressions are not compatible.

gcc/ada/

* sem_ch4.adb (Analyze_Case_Expression): Rewrite.
(Analyze_If_Expression): Likewise.
(Possible_Type_For_Conditional_Expression): New function.
* sem_type.adb (Specific_Type): Retur the base type in more
cases.
gcc/ada/sem_ch4.adb
gcc/ada/sem_type.adb