aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2021-09-09 06:29:43 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2021-10-05 08:20:00 +0000
commitf88db1839a2492645c894946b24311cf592fd0fc (patch)
tree043af39b60f802c946f56480d9827af6dee819d1 /gcc
parentf46939f9d4091e78e60d8d4d78d023a48a1608aa (diff)
downloadgcc-f88db1839a2492645c894946b24311cf592fd0fc.zip
gcc-f88db1839a2492645c894946b24311cf592fd0fc.tar.gz
gcc-f88db1839a2492645c894946b24311cf592fd0fc.tar.bz2
[Ada] Improve error message on missing all/for in quantified expression
gcc/ada/ * sem_res.adb (Resolve): Recognize specially that case.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_res.adb18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 9b8c622..0bdc463 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -3098,6 +3098,24 @@ package body Sem_Res is
Error_Msg_N ("\use -gnatf for details", N);
end if;
+ -- Recognize the case of a quantified expression being mistaken
+ -- for an iterated component association because the user
+ -- forgot the "all" or "some" keyword after "for". Because the
+ -- error message starts with "missing ALL", we automatically
+ -- benefit from the associated CODEFIX, which requires that
+ -- the message is located on the identifier following "for"
+ -- in order for the CODEFIX to insert "all" in the right place.
+
+ elsif Nkind (N) = N_Aggregate
+ and then List_Length (Component_Associations (N)) = 1
+ and then Nkind (First (Component_Associations (N)))
+ = N_Iterated_Component_Association
+ and then Is_Boolean_Type (Typ)
+ then
+ Error_Msg_N -- CODEFIX
+ ("missing ALL or SOME in quantified expression",
+ Defining_Identifier (First (Component_Associations (N))));
+
else
Wrong_Type (N, Typ);
end if;