From f41519ef3fa90151739099da21f51c75f765320b Mon Sep 17 00:00:00 2001 From: Romain Beguet Date: Tue, 4 Apr 2023 18:02:44 +0200 Subject: [PATCH] Fix navigation on top-level generic subp instantiation. --- ada/ast.py | 2 +- testsuite/tests/navigation/subp_inst_next_part/subp.ads | 8 ++++++++ testsuite/tests/navigation/subp_inst_next_part/subp_g.adb | 4 ++++ testsuite/tests/navigation/subp_inst_next_part/subp_g.ads | 2 ++ testsuite/tests/navigation/subp_inst_next_part/test.out | 5 +++++ testsuite/tests/navigation/subp_inst_next_part/test.yaml | 2 ++ 6 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 testsuite/tests/navigation/subp_inst_next_part/subp.ads create mode 100644 testsuite/tests/navigation/subp_inst_next_part/subp_g.adb create mode 100644 testsuite/tests/navigation/subp_inst_next_part/subp_g.ads create mode 100644 testsuite/tests/navigation/subp_inst_next_part/test.out create mode 100644 testsuite/tests/navigation/subp_inst_next_part/test.yaml diff --git a/ada/ast.py b/ada/ast.py index 008755683..54aa0e900 100644 --- a/ada/ast.py +++ b/ada/ast.py @@ -3179,7 +3179,7 @@ def basic_decl_next_part_for_decl(): b.is_a( T.BasePackageDecl, T.GenericPackageDecl, - T.GenericPackageInstantiation, + T.GenericInstantiation, T.PackageRenamingDecl, T.SubpRenamingDecl, T.GenericRenamingDecl diff --git a/testsuite/tests/navigation/subp_inst_next_part/subp.ads b/testsuite/tests/navigation/subp_inst_next_part/subp.ads new file mode 100644 index 000000000..060212597 --- /dev/null +++ b/testsuite/tests/navigation/subp_inst_next_part/subp.ads @@ -0,0 +1,8 @@ +with Subp_G; + +-- The result should be 'None' but should not raise an error saying +-- that file 'Subp.adb' is not found, since we don't expect to have a body +-- for this unit. + +procedure Subp is new Subp_G; +--% node.p_next_part_for_decl() diff --git a/testsuite/tests/navigation/subp_inst_next_part/subp_g.adb b/testsuite/tests/navigation/subp_inst_next_part/subp_g.adb new file mode 100644 index 000000000..5cf0a763d --- /dev/null +++ b/testsuite/tests/navigation/subp_inst_next_part/subp_g.adb @@ -0,0 +1,4 @@ +procedure Subp_G is +begin + null; +end Subp_G; diff --git a/testsuite/tests/navigation/subp_inst_next_part/subp_g.ads b/testsuite/tests/navigation/subp_inst_next_part/subp_g.ads new file mode 100644 index 000000000..c98baf452 --- /dev/null +++ b/testsuite/tests/navigation/subp_inst_next_part/subp_g.ads @@ -0,0 +1,2 @@ +generic +procedure Subp_G; diff --git a/testsuite/tests/navigation/subp_inst_next_part/test.out b/testsuite/tests/navigation/subp_inst_next_part/test.out new file mode 100644 index 000000000..9daa24260 --- /dev/null +++ b/testsuite/tests/navigation/subp_inst_next_part/test.out @@ -0,0 +1,5 @@ +Working on node +===================================================================== + +Eval 'node.p_next_part_for_decl()' +Result: None diff --git a/testsuite/tests/navigation/subp_inst_next_part/test.yaml b/testsuite/tests/navigation/subp_inst_next_part/test.yaml new file mode 100644 index 000000000..083a04575 --- /dev/null +++ b/testsuite/tests/navigation/subp_inst_next_part/test.yaml @@ -0,0 +1,2 @@ +driver: inline-playground +input_sources: [subp.ads]