ada: Fix bogus error on conditional expression with only user-defined literals
commit47853d3acefbdedfad9ef693a3184093ceaab7fd
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 7 Apr 2023 07:16:12 +0000 (7 09:16 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 29 May 2023 08:23:22 +0000 (29 10:23 +0200)
tree1dfee816c61e7c49af5f5a8fc05fbd9507493e2e
parent9f29fc75351870da24c1a94986be031989a88509
ada: Fix bogus error on conditional expression with only user-defined literals

This implements the recursive resolution of conditional expressions whose
dependent expressions are (all) user-defined literals the same way it is
implemented for operators.

gcc/ada/

* sem_res.adb (Has_Applicable_User_Defined_Literal): Make it clear
that the predicate also checks the node itself.
(Try_User_Defined_Literal): Move current implementation to...
Deal only with literals, named numbers and conditional expressions
whose dependent expressions are literals or named numbers.
(Try_User_Defined_Literal_For_Operator): ...this.  Remove multiple
return False statements and put a single one at the end.
(Resolve): Call Try_User_Defined_Literal instead of directly
Has_Applicable_User_Defined_Literal for all nodes.  Call
Try_User_Defined_Literal_For_Operator for operator nodes.
gcc/ada/sem_res.adb