-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'topic/981-fix' into 'master'
Fix visibility from child packages' public part. Closes #981 See merge request eng/libadalang/libadalang!1434
- Loading branch information
Showing
10 changed files
with
159 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
testsuite/tests/name_resolution/overload_private_type/pkg-bar.ads
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package Pkg.Bar is | ||
procedure Foo (X : Array_T) is null; | ||
procedure Foo (X : Record_T) is null; | ||
end Pkg.Bar; |
8 changes: 8 additions & 0 deletions
8
testsuite/tests/name_resolution/overload_private_type/pkg.ads
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package Pkg is | ||
type Array_T is array (Positive range <>) of Float; | ||
type Record_T is private; | ||
private | ||
type Record_T is record | ||
X, Y : Integer; | ||
end record; | ||
end Pkg; |
9 changes: 9 additions & 0 deletions
9
testsuite/tests/name_resolution/overload_private_type/test.adb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
with Pkg.Bar; | ||
|
||
procedure Test is | ||
begin | ||
Pkg.Bar.Foo ((1.0, 2.0)); | ||
pragma Test_Statement; | ||
end Test; | ||
|
||
|
44 changes: 44 additions & 0 deletions
44
testsuite/tests/name_resolution/overload_private_type/test.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Analyzing test.adb | ||
################## | ||
|
||
Resolving xrefs for node <CallStmt test.adb:5:4-5:29> | ||
***************************************************** | ||
|
||
Expr: <CallExpr test.adb:5:4-5:28> | ||
references: <DefiningName "Foo" pkg-bar.ads:2:14-2:17> | ||
type: None | ||
expected type: None | ||
Expr: <DottedName test.adb:5:4-5:15> | ||
references: <DefiningName "Foo" pkg-bar.ads:2:14-2:17> | ||
type: None | ||
expected type: None | ||
Expr: <DottedName test.adb:5:4-5:11> | ||
references: <DefiningName "Pkg.Bar" pkg-bar.ads:1:9-1:16> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Pkg" test.adb:5:4-5:7> | ||
references: <DefiningName "Pkg" pkg.ads:1:9-1:12> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Bar" test.adb:5:8-5:11> | ||
references: <DefiningName "Pkg.Bar" pkg-bar.ads:1:9-1:16> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Foo" test.adb:5:12-5:15> | ||
references: <DefiningName "Foo" pkg-bar.ads:2:14-2:17> | ||
type: None | ||
expected type: None | ||
Expr: <Aggregate test.adb:5:17-5:27> | ||
type: <ConcreteTypeDecl ["Array_T"] pkg.ads:2:4-2:55> | ||
expected type: <ConcreteTypeDecl ["Array_T"] pkg.ads:2:4-2:55> | ||
Expr: <Real test.adb:5:18-5:21> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
expected type: <ConcreteTypeDecl ["Float"] __standard:14:3-15:51> | ||
Expr: <Real test.adb:5:23-5:26> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Real_Type_"] __standard:117:3-117:42> | ||
expected type: <ConcreteTypeDecl ["Float"] __standard:14:3-15:51> | ||
|
||
|
||
Done. |
2 changes: 2 additions & 0 deletions
2
testsuite/tests/name_resolution/overload_private_type/test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
driver: name-resolution | ||
input_sources: [test.adb] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-- Test that ``p_most_visible_part`` works as expected inside the public part | ||
-- of child packages: since we don't have view on the private part of the | ||
-- parent package at this point, the property must return the partial (public) | ||
-- view of the designated type. | ||
package Pkg.Child is | ||
subtype U is T; | ||
--% full_view = node.p_get_type() | ||
--% view_from_here = full_view.p_most_visible_part(node) | ||
end Pkg.Child; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package Pkg is | ||
type T is private; | ||
private | ||
type T is null record; | ||
end Pkg; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Working on node <SubtypeDecl ["U"] pkg-child.ads:6:4-6:19> | ||
========================================================== | ||
|
||
Set 'full_view' to 'node.p_get_type()' | ||
Result: <ConcreteTypeDecl ["T"] pkg.ads:4:4-4:26> | ||
|
||
Set 'view_from_here' to 'full_view.p_most_visible_part(node)' | ||
Result: <ConcreteTypeDecl ["T"] pkg.ads:2:4-2:22> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
driver: inline-playground | ||
input_sources: [pkg-child.ads] |