Analyze_Dimension (N);
return;
- -- Return if type = Any_Type (previous error encountered). except that
- -- a Raise_Expression node is OK: it is legitimately labeled this way
- -- since it provides no information on the context.
+ -- A Raise_Expression takes its type from context. The expression
+ -- itself does not specify any possible interpretation.
- elsif Etype (N) = Any_Type and then Nkind (N) /= N_Raise_Expression then
+ -- Seems confusing to set the Etype to Typ here, only to be overwritten
+ -- and set to Ctx_Type in the big case statement???
+
+ elsif Nkind (N) = N_Raise_Expression then
+ Set_Etype (N, Typ);
+
+ -- Return if type = Any_Type (previous error encountered).
+
+ elsif Etype (N) = Any_Type then
Debug_A_Exit ("resolving ", N, " (done, Etype = Any_Type)");
return;
end if;
and then Scope (It.Nam) = Standard_Standard
then
Error_Msg_N
- ("\\possible interpretation as " &
- "universal_fixed operation " &
- "(RM 4.5.5 (19))", N);
+ ("\\possible interpretation as universal_fixed "
+ & "operation (RM 4.5.5 (19))", N);
else
Error_Msg_N
("\\possible interpretation (predefined)#!", N);
end if;
Error_Msg_Node_2 := Typ;
- Error_Msg_NE ("no visible interpretation of&" &
- " matches expected type&", N, Subp_Name);
+ Error_Msg_NE
+ ("no visible interpretation of& "
+ & "matches expected type&", N, Subp_Name);
end;
if All_Errors_Mode then
or else Is_By_Reference_Type (Etype (Expression (A)))
then
Error_Msg_N
- ("view conversion between unrelated by reference " &
- "array types not allowed (\'A'I-00246)", A);
+ ("view conversion between unrelated by reference "
+ & "array types not allowed (\'A'I-00246)", A);
-- In Ada 2005 mode, check view conversion component
-- type cannot be private, tagged, or volatile. Note
or else Is_Limited_Type (Etype (Expression (A))))
then
Error_Msg_N
- ("conversion between unrelated limited array types " &
- "not allowed (\A\I-00246)", A);
+ ("conversion between unrelated limited array types "
+ & "not allowed (\A\I-00246)", A);
if Is_Limited_Type (Etype (F)) then
Explain_Limited_Type (Etype (F), A);
and then No (Non_Limited_View (Desig))
then
Error_Msg_NE
- ("premature use of incomplete type& " &
- "in dispatching call", A, Desig);
+ ("premature use of incomplete type& "
+ & "in dispatching call", A, Desig);
end if;
end;
end if;
(Etype (Pool), Name_Simple_Storage_Pool_Type))
then
Error_Msg_N
- ("limited function calls not yet supported in simple " &
- "storage pool allocators", Expression (E));
+ ("limited function calls not yet supported in simple "
+ & "storage pool allocators", Expression (E));
end if;
end;
end if;
Deepest_Type_Access_Level (Typ)
then
if In_Instance_Body then
- Error_Msg_N ("??type in allocator has deeper level than" &
- " designated class-wide type", E);
- Error_Msg_N ("\??Program_Error will be raised at run time",
- E);
+ Error_Msg_N
+ ("??type in allocator has deeper level than "
+ & " designated class-wide type", E);
+ Error_Msg_N
+ ("\??Program_Error will be raised at run time", E);
Rewrite (N,
Make_Raise_Program_Error (Sloc (N),
Reason => PE_Accessibility_Check_Failed));
-- type. A run-time check will be performed in the instance.
elsif not Is_Generic_Type (Exp_Typ) then
- Error_Msg_N ("type in allocator has deeper level than" &
- " designated class-wide type", E);
+ Error_Msg_N ("type in allocator has deeper level than "
+ & "designated class-wide type", E);
end if;
end if;
end;
and then not Machine_Overflows_On_Target
then
Error_Msg_N
- ("float division by zero, " &
- "may generate '+'/'- infinity??", Right_Opnd (N));
+ ("float division by zero, may generate "
+ & "'+'/'- infinity??", Right_Opnd (N));
-- For all other cases, we get a Constraint_Error
Error_Msg_Name_1 := Chars (Etype (Target));
Error_Msg_Name_2 := Chars (Opnd);
Error_Msg_N
- ("wrong interface conversion (% is not a progenitor " &
- "of %)", N);
+ ("wrong interface conversion (% is not a progenitor "
+ & "of %)", N);
end if;
else
Msg : String) return Boolean;
-- Little routine to post Msg if Valid is False, returns Valid value
- -- The following are badly named, this kind of overloading is actively
- -- confusing in reading code, please rename to something like
- -- Error_Msg_N_If_Reporting ???
-
- procedure Error_Msg_N (Msg : String; N : Node_Or_Entity_Id);
+ procedure Conversion_Error_N (Msg : String; N : Node_Or_Entity_Id);
-- If Report_Errs, then calls Errout.Error_Msg_N with its arguments
- procedure Error_Msg_NE
+ procedure Conversion_Error_NE
(Msg : String;
N : Node_Or_Entity_Id;
E : Node_Or_Entity_Id);
and then not In_Instance
then
- Error_Msg_N (Msg, Operand);
+ Conversion_Error_N (Msg, Operand);
end if;
return Valid;
end Conversion_Check;
- -----------------
- -- Error_Msg_N --
- -----------------
+ ------------------------
+ -- Conversion_Error_N --
+ ------------------------
- procedure Error_Msg_N (Msg : String; N : Node_Or_Entity_Id) is
+ procedure Conversion_Error_N (Msg : String; N : Node_Or_Entity_Id) is
begin
if Report_Errs then
- Errout.Error_Msg_N (Msg, N);
+ Error_Msg_N (Msg, N);
end if;
- end Error_Msg_N;
+ end Conversion_Error_N;
- ------------------
- -- Error_Msg_NE --
- ------------------
+ -------------------------
+ -- Conversion_Error_NE --
+ -------------------------
- procedure Error_Msg_NE
+ procedure Conversion_Error_NE
(Msg : String;
N : Node_Or_Entity_Id;
E : Node_Or_Entity_Id)
is
begin
if Report_Errs then
- Errout.Error_Msg_NE (Msg, N, E);
+ Error_Msg_NE (Msg, N, E);
end if;
- end Error_Msg_NE;
+ end Conversion_Error_NE;
----------------------------
-- Valid_Array_Conversion --
if
Number_Dimensions (Target_Type) /= Number_Dimensions (Opnd_Type)
then
- Error_Msg_N
+ Conversion_Error_N
("incompatible number of dimensions for conversion", Operand);
return False;
and then (Root_Type (Target_Index_Type)
/= Root_Type (Opnd_Index_Type))
then
- Error_Msg_N
+ Conversion_Error_N
("incompatible index types for array conversion",
Operand);
return False;
Deepest_Type_Access_Level (Opnd_Type)
then
if In_Instance_Body then
- Error_Msg_N
- ("??source array type has " &
- "deeper accessibility level than target", Operand);
- Error_Msg_N
+ Conversion_Error_N
+ ("??source array type has deeper accesibility "
+ & "level than target", Operand);
+ Conversion_Error_N
("\??Program_Error will be raised at run time",
Operand);
Rewrite (N,
-- Conversion not allowed because of accessibility levels
else
- Error_Msg_N
- ("source array type has " &
- "deeper accessibility level than target", Operand);
+ Conversion_Error_N
+ ("source array type has deeper accessibility "
+ & "level than target", Operand);
return False;
end if;
-- All other cases where component base types do not match
else
- Error_Msg_N
+ Conversion_Error_N
("incompatible component types for array conversion",
Operand);
return False;
if not Subtypes_Statically_Match
(Target_Comp_Type, Opnd_Comp_Type)
then
- Error_Msg_N
+ Conversion_Error_N
("component subtypes must statically match", Operand);
return False;
end if;
return True;
else
- Error_Msg_NE
+ Conversion_Error_NE
("invalid tagged conversion, not compatible with}",
N, First_Subtype (Opnd_Type));
return False;
It1 := It;
if No (It.Typ) then
- Error_Msg_N ("illegal operand in conversion", Operand);
+ Conversion_Error_N ("illegal operand in conversion", Operand);
return False;
end if;
It1 := Disambiguate (Operand, I1, I, Any_Type);
if It1 = No_Interp then
- Error_Msg_N ("ambiguous operand in conversion", Operand);
+ Conversion_Error_N
+ ("ambiguous operand in conversion", Operand);
-- If the interpretation involves a standard operator, use
-- the location of the type, which may be user-defined.
Error_Msg_Sloc := Sloc (It.Nam);
end if;
- Error_Msg_N -- CODEFIX
+ Conversion_Error_N -- CODEFIX
("\\possible interpretation#!", Operand);
if Sloc (N1) = Standard_Location then
Error_Msg_Sloc := Sloc (N1);
end if;
- Error_Msg_N -- CODEFIX
+ Conversion_Error_N -- CODEFIX
("\\possible interpretation#!", Operand);
return False;
or else Opnd_Type = Any_Composite
or else Opnd_Type = Any_String
then
- Error_Msg_N ("illegal operand for array conversion", Operand);
+ Conversion_Error_N
+ ("illegal operand for array conversion", Operand);
return False;
else
return Valid_Array_Conversion;
-- will be generated by Expand_N_Type_Conversion.
if In_Instance_Body then
- Error_Msg_N
+ Conversion_Error_N
("??cannot convert local pointer to non-local access type",
Operand);
- Error_Msg_N
+ Conversion_Error_N
("\??Program_Error will be raised at run time", Operand);
else
- Error_Msg_N
+ Conversion_Error_N
("cannot convert local pointer to non-local access type",
Operand);
return False;
-- will be generated by Expand_N_Type_Conversion.
if In_Instance_Body then
- Error_Msg_N
- ("??cannot convert access discriminant to non-local" &
- " access type", Operand);
- Error_Msg_N
+ Conversion_Error_N
+ ("??cannot convert access discriminant to non-local "
+ & "access type", Operand);
+ Conversion_Error_N
("\??Program_Error will be raised at run time",
Operand);
else
- Error_Msg_N
- ("cannot convert access discriminant to non-local" &
- " access type", Operand);
+ Conversion_Error_N
+ ("cannot convert access discriminant to non-local "
+ & "access type", Operand);
return False;
end if;
end if;
Ekind_In (Entity (Operand), E_In_Parameter, E_Constant)
and then Present (Discriminal_Link (Entity (Operand)))
then
- Error_Msg_N
+ Conversion_Error_N
("discriminant has deeper accessibility level than target",
Operand);
return False;
if Is_Access_Constant (Opnd_Type)
and then not Is_Access_Constant (Target_Type)
then
- Error_Msg_N
+ Conversion_Error_N
("access-to-constant operand type not allowed", Operand);
return False;
end if;
if Nkind (Associated_Node_For_Itype (Opnd_Type)) =
N_Object_Declaration
then
- Error_Msg_N
- ("implicit conversion of stand-alone anonymous " &
- "access object not allowed", Operand);
+ Conversion_Error_N
+ ("implicit conversion of stand-alone anonymous "
+ & "access object not allowed", Operand);
return False;
-- Implicit conversions aren't allowed for anonymous access
N_Function_Specification,
N_Procedure_Specification)
then
- Error_Msg_N
- ("implicit conversion of anonymous access formal " &
- "not allowed", Operand);
+ Conversion_Error_N
+ ("implicit conversion of anonymous access formal "
+ & "not allowed", Operand);
return False;
-- This is a case where there's an enclosing object whose
elsif Object_Access_Level (Operand)
= Scope_Depth (Standard_Standard)
then
- Error_Msg_N
- ("implicit conversion of anonymous access value " &
- "not allowed", Operand);
+ Conversion_Error_N
+ ("implicit conversion of anonymous access value "
+ & "not allowed", Operand);
return False;
-- In other cases, the level of the operand's type must be
elsif Type_Access_Level (Opnd_Type) >
Deepest_Type_Access_Level (Target_Type)
then
- Error_Msg_N
- ("implicit conversion of anonymous access value " &
- "violates accessibility", Operand);
+ Conversion_Error_N
+ ("implicit conversion of anonymous access value "
+ & "violates accessibility", Operand);
return False;
end if;
end if;
-- will be generated by Expand_N_Type_Conversion.
if In_Instance_Body then
- Error_Msg_N
+ Conversion_Error_N
("??cannot convert local pointer to non-local access type",
Operand);
- Error_Msg_N
+ Conversion_Error_N
("\??Program_Error will be raised at run time", Operand);
else
-- Avoid generation of spurious error message
if not Error_Posted (N) then
- Error_Msg_N
+ Conversion_Error_N
("cannot convert local pointer to non-local access type",
Operand);
end if;
-- will be generated by Expand_N_Type_Conversion.
if In_Instance_Body then
- Error_Msg_N
- ("??cannot convert access discriminant to non-local"
- & " access type", Operand);
- Error_Msg_N
+ Conversion_Error_N
+ ("??cannot convert access discriminant to non-local "
+ & "access type", Operand);
+ Conversion_Error_N
("\??Program_Error will be raised at run time",
Operand);
else
- Error_Msg_N
- ("cannot convert access discriminant to non-local" &
- " access type", Operand);
+ Conversion_Error_N
+ ("cannot convert access discriminant to non-local "
+ & "access type", Operand);
return False;
end if;
end if;
Ekind_In (Entity (Operand), E_In_Parameter, E_Constant)
and then Present (Discriminal_Link (Entity (Operand)))
then
- Error_Msg_N
+ Conversion_Error_N
("discriminant has deeper accessibility level than target",
Operand);
return False;
else
if not Same_Base then
- Error_Msg_NE
+ Conversion_Error_NE
("target designated type not compatible with }",
N, Base_Type (Opnd));
return False;
and then Known_Static_RM_Size (Opnd)
and then RM_Size (Target) /= RM_Size (Opnd)
then
- Error_Msg_NE
+ Conversion_Error_NE
("target designated subtype not compatible with }",
N, Opnd);
- Error_Msg_NE
+ Conversion_Error_NE
("\because sizes of the two designated subtypes differ",
N, Opnd);
return False;
or else not Is_Entity_Name (Name (Parent (N)))
or else not Is_Return_Object (Entity (Name (Parent (N)))))
then
- Error_Msg_N
+ Conversion_Error_N
("illegal attempt to store anonymous access to subprogram",
Operand);
- Error_Msg_N
- ("\value has deeper accessibility than any master " &
- "(RM 3.10.2 (13))",
+ Conversion_Error_N
+ ("\value has deeper accessibility than any master "
+ & "(RM 3.10.2 (13))",
Operand);
Error_Msg_NE
if Type_Access_Level (Opnd_Type) >
Deepest_Type_Access_Level (Target_Type)
then
- Error_Msg_N
+ Conversion_Error_N
("operand type has deeper accessibility level than target",
Operand);
end loop;
if T_Gen /= O_Gen then
- Error_Msg_N
- ("target type must be declared in same generic body"
- & " as operand type", N);
+ Conversion_Error_N
+ ("target type must be declared in same generic body "
+ & "as operand type", N);
end if;
end;
end if;
elsif Ekind (Target_Type) = E_Access_Type
and then Is_Access_Type (Opnd_Type)
then
- Error_Msg_N ("target type must be general access type!", N);
- Error_Msg_NE -- CODEFIX
+ Conversion_Error_N ("target type must be general access type!", N);
+ Conversion_Error_NE -- CODEFIX
("add ALL to }!", N, Target_Type);
return False;
else
- Error_Msg_NE ("invalid conversion, not compatible with }",
- N, Opnd_Type);
+ Conversion_Error_NE
+ ("invalid conversion, not compatible with }", N, Opnd_Type);
return False;
end if;
end Valid_Conversion;