Commit 3e1862b1 by Ed Schonberg Committed by Arnaud Charlet

sem_ch13.adb: Improve error recovery on illegal aspect.

2014-10-20  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch13.adb: Improve error recovery on illegal aspect.

From-SVN: r216472
parent a9bbfbd0
2014-10-20 Ed Schonberg <schonberg@adacore.com>
* sem_ch13.adb: Improve error recovery on illegal aspect.
2014-10-20 Arnaud Charlet <charlet@adacore.com> 2014-10-20 Arnaud Charlet <charlet@adacore.com>
* set_targ.adb (Write_Target_Dependent_Values, Write_Line): * set_targ.adb (Write_Target_Dependent_Values, Write_Line):
......
...@@ -1119,33 +1119,39 @@ package body Sem_Ch13 is ...@@ -1119,33 +1119,39 @@ package body Sem_Ch13 is
case A_Id is case A_Id is
-- For aspects whose expression is an optional Boolean, make -- For aspects whose expression is an optional Boolean, make
-- the corresponding pragma at the freezing point. -- the corresponding pragma at the freeze point.
when Boolean_Aspects | when Boolean_Aspects |
Library_Unit_Aspects => Library_Unit_Aspects =>
Make_Pragma_From_Boolean_Aspect (ASN); Make_Pragma_From_Boolean_Aspect (ASN);
-- Special handling for aspects that don't correspond to -- Special handling for aspects that don't correspond to
-- pragmas/attributes. -- pragmas/attributes.
when Aspect_Default_Value | when Aspect_Default_Value |
Aspect_Default_Component_Value => Aspect_Default_Component_Value =>
Analyze_Aspect_Default_Value (ASN); Analyze_Aspect_Default_Value (ASN);
-- Ditto for iterator aspects, because the corresponding -- Ditto for iterator aspects, because the corresponding
-- attributes may not have been analyzed yet. -- attributes may not have been analyzed yet.
when Aspect_Constant_Indexing | when Aspect_Constant_Indexing |
Aspect_Variable_Indexing | Aspect_Variable_Indexing |
Aspect_Default_Iterator | Aspect_Default_Iterator |
Aspect_Iterator_Element => Aspect_Iterator_Element =>
Analyze (Expression (ASN)); Analyze (Expression (ASN));
when Aspect_Iterable => if Etype (Expression (ASN)) = Any_Type then
Validate_Iterable_Aspect (E, ASN); Error_Msg_NE
("\aspect must be fully defined before & is frozen",
ASN, E);
end if;
when others => when Aspect_Iterable =>
null; Validate_Iterable_Aspect (E, ASN);
when others =>
null;
end case; end case;
Ritem := Aspect_Rep_Item (ASN); Ritem := Aspect_Rep_Item (ASN);
...@@ -3901,6 +3907,9 @@ package body Sem_Ch13 is ...@@ -3901,6 +3907,9 @@ package body Sem_Ch13 is
Ctrl := Etype (First_Formal (Subp)); Ctrl := Etype (First_Formal (Subp));
end if; end if;
-- Type of formal may be the class-wide type, an access to such,
-- or an incomplete view.
if Ctrl = Ent if Ctrl = Ent
or else Ctrl = Class_Wide_Type (Ent) or else Ctrl = Class_Wide_Type (Ent)
or else or else
...@@ -3908,6 +3917,9 @@ package body Sem_Ch13 is ...@@ -3908,6 +3917,9 @@ package body Sem_Ch13 is
and then (Designated_Type (Ctrl) = Ent and then (Designated_Type (Ctrl) = Ent
or else or else
Designated_Type (Ctrl) = Class_Wide_Type (Ent))) Designated_Type (Ctrl) = Class_Wide_Type (Ent)))
or else
(Ekind (Ctrl) = E_Incomplete_Type
and then Full_View (Ctrl) = Ent)
then then
null; null;
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment