Skip to content

Commit

Permalink
Merge branch 'topic/1111' into 'master'
Browse files Browse the repository at this point in the history
Filter out bodies when resolving generic renaming declarations

Closes #1111

See merge request eng/libadalang/libadalang!1435
  • Loading branch information
thvnx committed Oct 19, 2023
2 parents 8c12ec9 + b9c903d commit 7408474
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ada/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -11816,6 +11816,8 @@ class GenericRenamingDecl(BasicDecl):
# which is not the case here.
Entity.renaming_name.all_env_elements_internal(
seq=True, seq_from=Self, categories=no_prims
).filter(
lambda e: Not(e.is_a(Body))
).at(0)._.match(
lambda gd=T.GenericDecl: gd,
lambda grd=T.GenericRenamingDecl: grd.resolve,
Expand Down
10 changes: 10 additions & 0 deletions testsuite/tests/name_resolution/generic_renaming_decl_3/test.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
with Test_2;

procedure Test is
generic function Gen renames Test_2;

function Equals is new Gen (Integer);
pragma Test_Statement;
begin
null;
end Test;
17 changes: 17 additions & 0 deletions testsuite/tests/name_resolution/generic_renaming_decl_3/test.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Analyzing test.adb
##################

Resolving xrefs for node <GenericSubpInstantiation ["Equals"] test.adb:6:4-6:41>
********************************************************************************

Expr: <Id "Gen" test.adb:6:27-6:30>
references: <DefiningName "Test_2" test_2.ads:3:10-3:16>
type: None
expected type: None
Expr: <Id "Integer" test.adb:6:32-6:39>
references: <DefiningName "Integer" __standard:4:8-4:15>
type: None
expected type: None


Done.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
driver: name-resolution
input_sources: [test.adb]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function Test_2 (L, R : Operand_Type) return Boolean is
begin
return L = R;
end Test_2;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
generic
type Operand_Type is private;
function Test_2 (L, R : Operand_Type) return Boolean;

0 comments on commit 7408474

Please sign in to comment.