-
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/1030-2' into 'master'
Fix private visibility of child units. Closes #1030 See merge request eng/libadalang/libadalang!1404
- Loading branch information
Showing
15 changed files
with
230 additions
and
50 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
3 changes: 3 additions & 0 deletions
3
testsuite/tests/name_resolution/private_with_4/containers.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,3 @@ | ||
package Containers is | ||
I : Integer := 1; | ||
end Containers; |
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.Foo is | ||
package Socket_Lists is new Containers.Doubly_Linked_Lists (Integer); | ||
pragma Test_Statement; | ||
end Pkg.Foo; |
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,10 @@ | ||
with Ada; use Ada; | ||
with Ada.Containers.Doubly_Linked_Lists; | ||
|
||
private | ||
with Containers; | ||
|
||
package Pkg is | ||
package Socket_Lists is new Containers.Doubly_Linked_Lists (Integer); | ||
pragma Test_Statement; -- OK | ||
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,4 @@ | ||
package Pkg_2.Foo is | ||
package Socket_Lists is new Containers.Doubly_Linked_Lists (Integer); | ||
pragma Test_Statement; | ||
end Pkg_2.Foo; |
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,12 @@ | ||
with Ada; use Ada; | ||
with Ada.Containers.Doubly_Linked_Lists; | ||
|
||
private | ||
with Containers; | ||
|
||
package Pkg_2 is | ||
package Socket_Lists is new Containers.Doubly_Linked_Lists (Integer); | ||
pragma Test_Statement; -- OK | ||
private | ||
Tmp : Integer; | ||
end Pkg_2; |
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,49 @@ | ||
Analyzing pkg-foo.ads | ||
##################### | ||
|
||
Resolving xrefs for node <GenericPackageInstantiation ["Socket_Lists"] pkg-foo.ads:2:4-2:73> | ||
******************************************************************************************** | ||
|
||
Expr: <DottedName pkg-foo.ads:2:32-2:62> | ||
references: <DefiningName "Ada.Containers.Doubly_Linked_Lists" a-cdlili.ads:47:9-47:43> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Containers" pkg-foo.ads:2:32-2:42> | ||
references: <DefiningName "Ada.Containers" a-contai.ads:16:9-16:23> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Doubly_Linked_Lists" pkg-foo.ads:2:43-2:62> | ||
references: <DefiningName "Ada.Containers.Doubly_Linked_Lists" a-cdlili.ads:47:9-47:43> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Integer" pkg-foo.ads:2:64-2:71> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
|
||
|
||
Analyzing pkg_2-foo.ads | ||
####################### | ||
|
||
Resolving xrefs for node <GenericPackageInstantiation ["Socket_Lists"] pkg_2-foo.ads:2:4-2:73> | ||
********************************************************************************************** | ||
|
||
Expr: <DottedName pkg_2-foo.ads:2:32-2:62> | ||
references: <DefiningName "Ada.Containers.Doubly_Linked_Lists" a-cdlili.ads:47:9-47:43> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Containers" pkg_2-foo.ads:2:32-2:42> | ||
references: <DefiningName "Ada.Containers" a-contai.ads:16:9-16:23> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Doubly_Linked_Lists" pkg_2-foo.ads:2:43-2:62> | ||
references: <DefiningName "Ada.Containers.Doubly_Linked_Lists" a-cdlili.ads:47:9-47:43> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Integer" pkg_2-foo.ads:2:64-2:71> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
|
||
|
||
Done. |
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: [pkg-foo.ads, pkg_2-foo.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,3 @@ | ||
package Foo is | ||
X : Integer; | ||
end Foo; |
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,7 @@ | ||
package body Pkg.Bar is | ||
function Test return Integer is | ||
begin | ||
return Foo.X; | ||
pragma Test_Statement; | ||
end Test; | ||
end Pkg.Bar; |
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,6 @@ | ||
private package Pkg.Bar is | ||
function Test return Integer; | ||
|
||
Y : Integer := Foo.X; | ||
pragma Test_Statement; | ||
end Pkg.Bar; |
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 @@ | ||
private with Foo; | ||
|
||
package Pkg is | ||
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,45 @@ | ||
Analyzing pkg-bar.ads | ||
##################### | ||
|
||
Resolving xrefs for node <ObjectDecl ["Y"] pkg-bar.ads:4:4-4:25> | ||
**************************************************************** | ||
|
||
Expr: <Id "Integer" pkg-bar.ads:4:8-4:15> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
Expr: <DottedName pkg-bar.ads:4:19-4:24> | ||
references: <DefiningName "X" foo.ads:2:4-2:5> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <Id "Foo" pkg-bar.ads:4:19-4:22> | ||
references: <DefiningName "Foo" foo.ads:1:9-1:12> | ||
type: None | ||
expected type: None | ||
Expr: <Id "X" pkg-bar.ads:4:23-4:24> | ||
references: <DefiningName "X" foo.ads:2:4-2:5> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
|
||
|
||
Analyzing pkg-bar.adb | ||
##################### | ||
|
||
Resolving xrefs for node <ReturnStmt pkg-bar.adb:4:7-4:20> | ||
********************************************************** | ||
|
||
Expr: <DottedName pkg-bar.adb:4:14-4:19> | ||
references: <DefiningName "X" foo.ads:2:4-2:5> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <Id "Foo" pkg-bar.adb:4:14-4:17> | ||
references: <DefiningName "Foo" foo.ads:1:9-1:12> | ||
type: None | ||
expected type: None | ||
Expr: <Id "X" pkg-bar.adb:4:18-4:19> | ||
references: <DefiningName "X" foo.ads:2:4-2:5> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
|
||
|
||
Done. |
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: [pkg-bar.ads, pkg-bar.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,8 @@ | ||
type: bugfix | ||
title: Fix private-with visibility in child units | ||
description: | | ||
This change fixes a bug where child units were previously assumed to always | ||
have view on ``private with`` clauses of their parent unit, which is not the | ||
case in their public part. This could cause name resolution to incorrectly | ||
resolve names to entities that were not supposed to be visible. | ||
date: 2023-09-11 |