[Ada] Fix resolution of iterated component association
authorPiotr Trojanek <trojanek@adacore.com>
Tue, 19 Jul 2022 11:57:05 +0000 (13:57 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 5 Sep 2022 07:21:03 +0000 (09:21 +0200)
commit44bd2755a8bfd4c8849d97f058141c3d5a17647b
tree7c57e050ec18aaf8a2b3273c3d01744fc5fc9b01
parentcde3f9417540cfc61ff8e3c58b76e7d182b40db5
[Ada] Fix resolution of iterated component association

For iterator specification appearing inside an iterated component
association, we just did ad-hoc, incomplete checks and delayed a proper
analysis until the iterated component association is expanded into loop (and
then reanalyzed).

However, when the iterated component association is not expanded, e.g.
because we are in semantic checking mode, GNATprove mode or inside a
generic, then the AST lacked any processing or error reporting.

This is fixed by reusing the existing analysis of iterator specifications,
as they also appear in other constructs, e.g. in quantified expressions.

gcc/ada/

* sem_aggr.adb (Resolve_Iterated_Component_Association): Split
processing of cases with and without iterator specification; reuse
analysis of iterator specification; improve diagnostics for
premature usage of iterator index in discrete choices.
gcc/ada/sem_aggr.adb