[Ada] Error message on invalid conversion involving limited views
A type conversion may be illegal if the expression in the conversion has a limited view of a type. This patch expands the error report to indicate the presence of a limited view, and when the context is a package body it suggests the addition of a regular with-clause to make the full view available. Compiling client.adb must yield: client.adb:6:16: invalid conversion, not compatible with limited view of type "Map_Type" defined at maps.ads:2 client.adb:6:16: add with_clause for "Maps" to current unit ---- package Maps is type Map_Type is null record; end; ---- limited with Maps; package Payloads is function Get_Map return access Maps.Map_Type; end; ---- with Maps; package Maps2 is type New_Map_Type is new Maps.Map_Type; end; ---- with Maps2; package Client is procedure Foo (Map : Maps2.New_Map_Type) is null; procedure Bar; end; ---- with Payloads; package body Client is procedure Bar is begin Foo (Maps2.New_Map_Type (Payloads.Get_Map.all)); end; end; 2018-05-21 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_res.adb (Valid_Conversion): Improve error message on an illegal type conversion whose expression has a limited view of a type. From-SVN: r260466
Showing
Please
register
or
sign in
to comment