Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 68 additions & 33 deletions compiler_impl/src/safe_frontend-check_resolve.adb
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,8 @@ package body Safe_Frontend.Check_Resolve is
Imported_Subprograms : GM.External_Vectors.Vector;
Imported_Objects : Type_Maps.Map;
Imported_Static : Static_Value_Maps.Map;
Generic_Types : in out Generic_Type_Template_Maps.Map;
Generic_Functions : in out Generic_Function_Template_Maps.Map;
Visible_Types : in out Type_Maps.Map;
Visible_Functions : in out Function_Maps.Map;
Visible_Objects : in out Type_Maps.Map;
Expand Down Expand Up @@ -1362,7 +1364,7 @@ package body Safe_Frontend.Check_Resolve is
Type_Env,
Path,
Source_Expr.Elements (Index).Span);
end loop;
end loop;
end if;
end;
elsif FT.Lowercase (UString_Value (Base_Target.Kind)) = "record"
Expand All @@ -1385,7 +1387,7 @@ package body Safe_Frontend.Check_Resolve is
Found := True;
exit;
end if;
end loop;
end loop;
if Found then
Reject_Static_Bounded_String_Overflow
(Item.Expr,
Expand Down Expand Up @@ -2243,14 +2245,16 @@ package body Safe_Frontend.Check_Resolve is
is
Result : FT.UString :=
FT.To_UString
(Prefix & Sanitize_Type_Name_Component (Method_Target_Tail_Name (Name)));
(Prefix & Sanitize_Type_Name_Component (Canonical_Name (Name)));
begin
if not Actual_Types.Is_Empty then
for Item of Actual_Types loop
Result :=
Result
& FT.To_UString ("_")
& FT.To_UString (Sanitize_Type_Name_Component (UString_Value (Item)));
& FT.To_UString
(Sanitize_Type_Name_Component
(Canonical_Name (UString_Value (Item))));
end loop;
end if;
return UString_Value (Result);
Expand Down Expand Up @@ -2418,6 +2422,8 @@ package body Safe_Frontend.Check_Resolve is
Imported_Subprograms : GM.External_Vectors.Vector;
Imported_Objects : Type_Maps.Map;
Imported_Static : Static_Value_Maps.Map;
Generic_Types : in out Generic_Type_Template_Maps.Map;
Generic_Functions : in out Generic_Function_Template_Maps.Map;
Visible_Types : in out Type_Maps.Map;
Visible_Functions : in out Function_Maps.Map;
Visible_Objects : in out Type_Maps.Map;
Expand All @@ -2442,9 +2448,18 @@ package body Safe_Frontend.Check_Resolve is
begin
if From_Package (Qualified_Name)
and then Short_Name /= Qualified_Name
and then not Has_Type (Visible_Types, Short_Name)
then
Put_Type (Visible_Types, Short_Name, Item);
if not Has_Type (Visible_Types, Short_Name) then
Put_Type (Visible_Types, Short_Name, Item);
end if;
if not Item.Generic_Formals.Is_Empty
and then Generic_Types.Contains (Canonical_Name (Qualified_Name))
and then not Generic_Types.Contains (Canonical_Name (Short_Name))
then
Generic_Types.Include
(Canonical_Name (Short_Name),
Generic_Types.Element (Canonical_Name (Qualified_Name)));
end if;
end if;
end;
end loop;
Expand All @@ -2459,31 +2474,40 @@ package body Safe_Frontend.Check_Resolve is
begin
if From_Package (Qualified_Name)
and then Short_Name /= Qualified_Name
and then not Has_Function (Visible_Functions, Short_Name)
then
Info.Name := FT.To_UString (Short_Name);
Info.Kind := Item.Kind;
Info.Span := Item.Span;
Info.Has_Return_Type := Item.Has_Return_Type;
Info.Return_Is_Access_Def := Item.Return_Is_Access_Def;
if Item.Has_Return_Type then
Info.Return_Type := Item.Return_Type;
end if;
if not Item.Params.Is_Empty then
for Param of Item.Params loop
declare
Symbol : CM.Symbol;
begin
Symbol.Name := Param.Name;
Symbol.Kind := Param.Kind;
Symbol.Mode := Param.Mode;
Symbol.Type_Info := Param.Type_Info;
Symbol.Span := Param.Span;
Info.Params.Append (Symbol);
end;
end loop;
if Item.Generic_Formals.Is_Empty then
if not Has_Function (Visible_Functions, Short_Name) then
Info.Name := FT.To_UString (Short_Name);
Info.Kind := Item.Kind;
Info.Span := Item.Span;
Info.Has_Return_Type := Item.Has_Return_Type;
Info.Return_Is_Access_Def := Item.Return_Is_Access_Def;
if Item.Has_Return_Type then
Info.Return_Type := Item.Return_Type;
end if;
if not Item.Params.Is_Empty then
for Param of Item.Params loop
declare
Symbol : CM.Symbol;
begin
Symbol.Name := Param.Name;
Symbol.Kind := Param.Kind;
Symbol.Mode := Param.Mode;
Symbol.Type_Info := Param.Type_Info;
Symbol.Span := Param.Span;
Info.Params.Append (Symbol);
end;
end loop;
end if;
Put_Function (Visible_Functions, Short_Name, Info);
end if;
elsif Generic_Functions.Contains (Canonical_Name (Qualified_Name))
and then not Generic_Functions.Contains (Canonical_Name (Short_Name))
then
Generic_Functions.Include
(Canonical_Name (Short_Name),
Generic_Functions.Element (Canonical_Name (Qualified_Name)));
end if;
Put_Function (Visible_Functions, Short_Name, Info);
end if;
end;
end loop;
Expand Down Expand Up @@ -7223,6 +7247,7 @@ package body Safe_Frontend.Check_Resolve is
then CM.Type_Spec_Access_Vectors.Empty_Vector
else Expr.Callee.Generic_Args);
Template : Generic_Function_Template_Info;
Template_Name : FT.UString := FT.To_UString ("");
Actual_Type_Names : FT.UString_Vectors.Vector;
Key : FT.UString := FT.To_UString ("");
Specialized_Name : FT.UString := FT.To_UString ("");
Expand All @@ -7239,6 +7264,7 @@ package body Safe_Frontend.Check_Resolve is
end if;

Template := Current_Generic_Function_Templates.Element (Canonical_Name (Callee_Name));
Template_Name := Template.Info.Name;
for Arg of Generic_Args loop
Actual_Type_Names.Append
(Resolve_Type_Spec (Arg.all, Type_Env, Const_Env, Path).Name);
Expand All @@ -7265,7 +7291,7 @@ package body Safe_Frontend.Check_Resolve is
& " arguments"));
end if;

Key := FT.To_UString (Generic_Template_Key (Callee_Name, Actual_Type_Names));
Key := FT.To_UString (Generic_Template_Key (UString_Value (Template_Name), Actual_Type_Names));
if Current_Generic_Specialization_By_Key.Contains (UString_Value (Key)) then
Specialized_Name :=
FT.To_UString
Expand All @@ -7277,7 +7303,7 @@ package body Safe_Frontend.Check_Resolve is
FT.To_UString
(Generic_Specialization_Name
("Safe_Generic_",
Callee_Name,
UString_Value (Template_Name),
Actual_Type_Names));
Clone.Spec.Name := Specialized_Name;
Clone.Is_Public := False;
Expand Down Expand Up @@ -11561,7 +11587,11 @@ package body Safe_Frontend.Check_Resolve is
Path,
Spec.Span);

Instantiation_Key := FT.To_UString (Generic_Template_Key (Template_Name, Actual_Type_Names));
Instantiation_Key :=
FT.To_UString
(Generic_Template_Key
(UString_Value (Template.Info.Name),
Actual_Type_Names));
if Current_Generic_Type_Instantiation_By_Key.Contains (UString_Value (Instantiation_Key)) then
Concrete_Name :=
FT.To_UString
Expand All @@ -11585,7 +11615,10 @@ package body Safe_Frontend.Check_Resolve is

Concrete_Name :=
FT.To_UString
(Generic_Specialization_Name ("__generic_", Template_Name, Actual_Type_Names));
(Generic_Specialization_Name
("__generic_",
UString_Value (Template.Info.Name),
Actual_Type_Names));
if Template.Has_Decl then
Clone := Template.Decl;
Clone.Generic_Formals.Clear;
Expand Down Expand Up @@ -13595,6 +13628,8 @@ package body Safe_Frontend.Check_Resolve is
Result.Imported_Subprograms,
Imported_Objects,
Const_Env,
Current_Generic_Type_Templates,
Current_Generic_Function_Templates,
Local_Type_Env,
Local_Functions,
Local_Imported_Objects,
Expand Down
2 changes: 1 addition & 1 deletion docs/post_pr10_scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ residuals are the broader-than-admitted follow-ons `PS-019`, `PS-035`, and
|----|------|--------|------|----------|
| `PS-016` | Selective interface search-dir scanning or scoped tolerance for unrelated malformed `.safei.json` files | `PR08.3` review fallout | `tooling` | `nice-to-have` |
| `PS-017` | Ada-side Bronze regression harness independent of Python evidence re-derivation | `PR08.2` review fallout | `tooling` | `nice-to-have` |
| `PS-018` | Emitted-output GNATprove coverage beyond the selected PR10 concurrency corpus and the named sequential checkpoints; after `PR11.8b`, the retained emitted concurrency corpus is closed and this item remains only as a placeholder for any future proof-bearing admitted surface beyond the current checkpoints | `docs/emitted_output_verification_matrix.md`; `docs/PR11.x-series-proposed.md` | `tooling` | `long-term` |
| `PS-018` | Emitted-output GNATprove coverage beyond the selected PR10 concurrency corpus and the named sequential checkpoints; after `PR11.8b`, the retained emitted concurrency corpus is closed and this item remains only as a placeholder for any future proof-bearing admitted surface beyond the current checkpoints | `docs/emitted_output_verification_matrix.md`; `docs/roadmap.md` | `tooling` | `long-term` |
| `PS-019` | I/O seam wrapper obligations beyond direct emitted-package proof | `docs/emitted_output_verification_matrix.md` | `tooling` | `long-term` |
| `PS-020` | Diagnostic catalogue and localisation `TBD-05` | `spec/00-front-matter.md` section `0.8` | `tooling` | `long-term` |
| `PS-021` | Stabilise and document interchange-format policy for existing `safei-v1` and `mir-v2` artifacts, including compatibility and what is normative versus implementation-defined `TBD-08` | `spec/00-front-matter.md` section `0.8`; `compiler_impl/src/safe_frontend-interfaces.adb`; `compiler_impl/src/safe_frontend-mir_analyze.adb` | `tooling` | `long-term` |
Expand Down
Loading
Loading