Skip to content

Commit

Permalink
Merge branch 'topic/als_1210' into 'master'
Browse files Browse the repository at this point in the history
Process extended projects when computing closure.

See merge request eng/libadalang/libadalang!1503
  • Loading branch information
Roldak committed Jan 9, 2024
2 parents d2d9db8 + d4cbdb8 commit 109c243
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 2 deletions.
10 changes: 8 additions & 2 deletions extensions/src/libadalang-gpr_utils.adb
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,15 @@ package body Libadalang.GPR_Utils is
Visit (P);
end loop;

-- TODO??? (VC07-012) What about extended projects? We should
-- probably use a robust implementation provided by GPR2.
if Self.Is_Extending then
for P of Self.Extended loop
Visit (P);
end loop;
end if;

-- TODO??? (VC07-012) This is probably not complete. We should
-- transition this to use a robust implementation provided by GPR2
-- once available.
end Visit;

begin
Expand Down
3 changes: 3 additions & 0 deletions testsuite/tests/ada_api/gpr2_project_unit_provider/dep.gpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
project Dep is
for Source_Dirs use ("src-dep");
end Dep;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
with "dep";

abstract project Extended is
end Extended;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
project Extending extends "extended.gpr" is
for Source_Dirs use ("src-extending");
end Extending;
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ begin
Resolve ("p.gpr", "p2");
Resolve ("multi_unit_files_1.gpr", "objects");
Resolve ("multi_unit_files_2.gpr", "objects");
Resolve ("extending.gpr", "ext");

Put_Line ("Done.");
end Main;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package Dep is
type T is null record;
end Dep;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
with Dep;

package Ext is
X : Dep.T;
end Ext;
6 changes: 6 additions & 0 deletions testsuite/tests/ada_api/gpr2_project_unit_provider/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,10 @@ Loading multi_unit_files_2.gpr...
<SubtypeIndication multi_unit_files.ada:4:9-4:17> resolves to:
<ConcreteTypeDecl ["T1"] multi_unit_files.ada:8:4-8:27>

== Resolutions in extending.gpr ==

Loading extending.gpr...
<SubtypeIndication ext.ads:4:8-4:13> resolves to:
<ConcreteTypeDecl ["T"] dep.ads:2:4-2:26>

Done.

0 comments on commit 109c243

Please sign in to comment.