diff --git a/ada/ast.py b/ada/ast.py index e97f4634c..d542683d8 100644 --- a/ada/ast.py +++ b/ada/ast.py @@ -23499,7 +23499,7 @@ class PackageBody(Body): # want to reference the envs that are "used" there. reference(Self.cast(AdaNode).singleton, through=T.PackageBody.package_decl_uses_clauses_envs, - cond=Not(Self.is_compilation_unit_root)) + cond=Not(Self.is_compilation_unit_root) | Self.is_subunit) ) package_name = Field(type=T.DefiningName) diff --git a/testsuite/tests/name_resolution/use_clause_separate_pkg/pkg-inner.adb b/testsuite/tests/name_resolution/use_clause_separate_pkg/pkg-inner.adb new file mode 100644 index 000000000..d623dd8ca --- /dev/null +++ b/testsuite/tests/name_resolution/use_clause_separate_pkg/pkg-inner.adb @@ -0,0 +1,9 @@ +separate(Pkg) +package body Inner is + procedure Bar is + X : T; + pragma Test_Statement; + begin + null; + end Bar; +end Inner; diff --git a/testsuite/tests/name_resolution/use_clause_separate_pkg/pkg.adb b/testsuite/tests/name_resolution/use_clause_separate_pkg/pkg.adb new file mode 100644 index 000000000..66ea991e3 --- /dev/null +++ b/testsuite/tests/name_resolution/use_clause_separate_pkg/pkg.adb @@ -0,0 +1,17 @@ +package body Pkg is + package Types is + type T is null record; + end Types; + + package Inner is + use Types; + procedure Bar; + end Inner; + + procedure Test is + begin + Inner.Bar; + end Test; + + package body Inner is separate; +end Pkg; diff --git a/testsuite/tests/name_resolution/use_clause_separate_pkg/pkg.ads b/testsuite/tests/name_resolution/use_clause_separate_pkg/pkg.ads new file mode 100644 index 000000000..c9e0d676f --- /dev/null +++ b/testsuite/tests/name_resolution/use_clause_separate_pkg/pkg.ads @@ -0,0 +1,3 @@ +package Pkg is + procedure Test; +end Pkg; diff --git a/testsuite/tests/name_resolution/use_clause_separate_pkg/test.out b/testsuite/tests/name_resolution/use_clause_separate_pkg/test.out new file mode 100644 index 000000000..5f7af7bd0 --- /dev/null +++ b/testsuite/tests/name_resolution/use_clause_separate_pkg/test.out @@ -0,0 +1,13 @@ +Analyzing pkg-inner.adb +####################### + +Resolving xrefs for node +****************************************************************** + +Expr: + references: + type: None + expected type: None + + +Done. diff --git a/testsuite/tests/name_resolution/use_clause_separate_pkg/test.yaml b/testsuite/tests/name_resolution/use_clause_separate_pkg/test.yaml new file mode 100644 index 000000000..b8722998c --- /dev/null +++ b/testsuite/tests/name_resolution/use_clause_separate_pkg/test.yaml @@ -0,0 +1,2 @@ +driver: name-resolution +input_sources: [pkg-inner.adb]