-
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.
Better name resolution support for nested recursive procedures
This patch fixes a bug where nested subprograms, compiled separately as subunits, cannot refer to their top-level subprograms, which was leading to some name resolution failures.
- Loading branch information
Showing
7 changed files
with
329 additions
and
3 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
21 changes: 21 additions & 0 deletions
21
testsuite/tests/name_resolution/recursive_subunit/p1-p2-p3-p4.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,21 @@ | ||
separate (P1.P2.P3) | ||
procedure P4 is | ||
S : String (1 .. 2); | ||
C : Character; | ||
begin | ||
S := P2.S; | ||
pragma Test_Statement; | ||
|
||
C := P1.C; | ||
pragma Test_Statement; | ||
|
||
C := P2.H; | ||
pragma Test_Statement; | ||
|
||
S := P3.S; | ||
pragma Test_Statement; | ||
|
||
C := P3.C; | ||
pragma Test_Statement; | ||
|
||
end P4; |
15 changes: 15 additions & 0 deletions
15
testsuite/tests/name_resolution/recursive_subunit/p1-p2-p3.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,15 @@ | ||
separate (P1.P2) | ||
procedure P3 is | ||
S : String (1 .. 2); | ||
C : Character; | ||
procedure P4 is separate; | ||
begin | ||
S := P2.S; | ||
pragma Test_Statement; | ||
|
||
C := P1.C; | ||
pragma Test_Statement; | ||
|
||
C := P2.H; | ||
pragma Test_Statement; | ||
end P3; |
12 changes: 12 additions & 0 deletions
12
testsuite/tests/name_resolution/recursive_subunit/p1-p2.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,12 @@ | ||
separate (P1) | ||
procedure P2 (H : Character) is | ||
S : String (1 .. 2); | ||
C : Character; | ||
procedure P3 is separate; | ||
begin | ||
C := P1.C; | ||
pragma Test_Statement; | ||
|
||
S := P1.C & "-"; | ||
pragma Test_Statement; | ||
end P2; |
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 @@ | ||
procedure P1 is | ||
C : constant Character := '1'; | ||
procedure P2 (H : Character) is separate; | ||
begin | ||
null; | ||
end P1; |
227 changes: 227 additions & 0 deletions
227
testsuite/tests/name_resolution/recursive_subunit/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,227 @@ | ||
Analyzing p1-p2.adb | ||
################### | ||
|
||
Resolving xrefs for node <AssignStmt p1-p2.adb:7:6-7:16> | ||
******************************************************** | ||
|
||
Expr: <Id "C" p1-p2.adb:7:6-7:7> | ||
references: <DefiningName "C" p1-p2.adb:4:6-4:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: None | ||
Expr: <DottedName p1-p2.adb:7:11-7:15> | ||
references: <DefiningName "C" p1.adb:2:6-2:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
Expr: <Id "P1" p1-p2.adb:7:11-7:13> | ||
references: <DefiningName "P1" p1.adb:1:11-1:13> | ||
type: None | ||
expected type: None | ||
Expr: <Id "C" p1-p2.adb:7:14-7:15> | ||
references: <DefiningName "C" p1.adb:2:6-2:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
|
||
Resolving xrefs for node <AssignStmt p1-p2.adb:10:6-10:22> | ||
********************************************************** | ||
|
||
Expr: <Id "S" p1-p2.adb:10:6-10:7> | ||
references: <DefiningName "S" p1-p2.adb:3:6-3:7> | ||
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
expected type: None | ||
Expr: <ConcatOp p1-p2.adb:10:11-10:21> | ||
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
expected type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
Expr: <DottedName p1-p2.adb:10:11-10:15> | ||
references: <DefiningName "C" p1.adb:2:6-2:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
Expr: <Id "P1" p1-p2.adb:10:11-10:13> | ||
references: <DefiningName "P1" p1.adb:1:11-1:13> | ||
type: None | ||
expected type: None | ||
Expr: <Id "C" p1-p2.adb:10:14-10:15> | ||
references: <DefiningName "C" p1.adb:2:6-2:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
Expr: <ConcatOperand p1-p2.adb:10:16-10:21> | ||
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
expected type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
Expr: <OpConcat "&" p1-p2.adb:10:16-10:17> | ||
references: None | ||
type: None | ||
expected type: None | ||
Expr: <Str ""-"" p1-p2.adb:10:18-10:21> | ||
references: None | ||
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
expected type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
|
||
|
||
Analyzing p1-p2-p3.adb | ||
###################### | ||
|
||
Resolving xrefs for node <AssignStmt p1-p2-p3.adb:7:6-7:16> | ||
*********************************************************** | ||
|
||
Expr: <Id "S" p1-p2-p3.adb:7:6-7:7> | ||
references: <DefiningName "S" p1-p2-p3.adb:3:6-3:7> | ||
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
expected type: None | ||
Expr: <DottedName p1-p2-p3.adb:7:11-7:15> | ||
references: <DefiningName "S" p1-p2.adb:3:6-3:7> | ||
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
expected type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
Expr: <Id "P2" p1-p2-p3.adb:7:11-7:13> | ||
references: <DefiningName "P2" p1-p2.adb:2:11-2:13> | ||
type: None | ||
expected type: None | ||
Expr: <Id "S" p1-p2-p3.adb:7:14-7:15> | ||
references: <DefiningName "S" p1-p2.adb:3:6-3:7> | ||
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
expected type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
|
||
Resolving xrefs for node <AssignStmt p1-p2-p3.adb:10:6-10:16> | ||
************************************************************* | ||
|
||
Expr: <Id "C" p1-p2-p3.adb:10:6-10:7> | ||
references: <DefiningName "C" p1-p2-p3.adb:4:6-4:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: None | ||
Expr: <DottedName p1-p2-p3.adb:10:11-10:15> | ||
references: <DefiningName "C" p1.adb:2:6-2:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
Expr: <Id "P1" p1-p2-p3.adb:10:11-10:13> | ||
references: <DefiningName "P1" p1.adb:1:11-1:13> | ||
type: None | ||
expected type: None | ||
Expr: <Id "C" p1-p2-p3.adb:10:14-10:15> | ||
references: <DefiningName "C" p1.adb:2:6-2:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
|
||
Resolving xrefs for node <AssignStmt p1-p2-p3.adb:13:6-13:16> | ||
************************************************************* | ||
|
||
Expr: <Id "C" p1-p2-p3.adb:13:6-13:7> | ||
references: <DefiningName "C" p1-p2-p3.adb:4:6-4:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: None | ||
Expr: <DottedName p1-p2-p3.adb:13:11-13:15> | ||
references: <DefiningName "H" p1-p2.adb:2:15-2:16> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
Expr: <Id "P2" p1-p2-p3.adb:13:11-13:13> | ||
references: <DefiningName "P2" p1-p2.adb:2:11-2:13> | ||
type: None | ||
expected type: None | ||
Expr: <Id "H" p1-p2-p3.adb:13:14-13:15> | ||
references: <DefiningName "H" p1-p2.adb:2:15-2:16> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
|
||
|
||
Analyzing p1-p2-p3-p4.adb | ||
######################### | ||
|
||
Resolving xrefs for node <AssignStmt p1-p2-p3-p4.adb:6:6-6:16> | ||
************************************************************** | ||
|
||
Expr: <Id "S" p1-p2-p3-p4.adb:6:6-6:7> | ||
references: <DefiningName "S" p1-p2-p3-p4.adb:3:6-3:7> | ||
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
expected type: None | ||
Expr: <DottedName p1-p2-p3-p4.adb:6:11-6:15> | ||
references: <DefiningName "S" p1-p2.adb:3:6-3:7> | ||
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
expected type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
Expr: <Id "P2" p1-p2-p3-p4.adb:6:11-6:13> | ||
references: <DefiningName "P2" p1-p2.adb:2:11-2:13> | ||
type: None | ||
expected type: None | ||
Expr: <Id "S" p1-p2-p3-p4.adb:6:14-6:15> | ||
references: <DefiningName "S" p1-p2.adb:3:6-3:7> | ||
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
expected type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
|
||
Resolving xrefs for node <AssignStmt p1-p2-p3-p4.adb:9:6-9:16> | ||
************************************************************** | ||
|
||
Expr: <Id "C" p1-p2-p3-p4.adb:9:6-9:7> | ||
references: <DefiningName "C" p1-p2-p3-p4.adb:4:6-4:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: None | ||
Expr: <DottedName p1-p2-p3-p4.adb:9:11-9:15> | ||
references: <DefiningName "C" p1.adb:2:6-2:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
Expr: <Id "P1" p1-p2-p3-p4.adb:9:11-9:13> | ||
references: <DefiningName "P1" p1.adb:1:11-1:13> | ||
type: None | ||
expected type: None | ||
Expr: <Id "C" p1-p2-p3-p4.adb:9:14-9:15> | ||
references: <DefiningName "C" p1.adb:2:6-2:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
|
||
Resolving xrefs for node <AssignStmt p1-p2-p3-p4.adb:12:6-12:16> | ||
**************************************************************** | ||
|
||
Expr: <Id "C" p1-p2-p3-p4.adb:12:6-12:7> | ||
references: <DefiningName "C" p1-p2-p3-p4.adb:4:6-4:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: None | ||
Expr: <DottedName p1-p2-p3-p4.adb:12:11-12:15> | ||
references: <DefiningName "H" p1-p2.adb:2:15-2:16> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
Expr: <Id "P2" p1-p2-p3-p4.adb:12:11-12:13> | ||
references: <DefiningName "P2" p1-p2.adb:2:11-2:13> | ||
type: None | ||
expected type: None | ||
Expr: <Id "H" p1-p2-p3-p4.adb:12:14-12:15> | ||
references: <DefiningName "H" p1-p2.adb:2:15-2:16> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
|
||
Resolving xrefs for node <AssignStmt p1-p2-p3-p4.adb:15:6-15:16> | ||
**************************************************************** | ||
|
||
Expr: <Id "S" p1-p2-p3-p4.adb:15:6-15:7> | ||
references: <DefiningName "S" p1-p2-p3-p4.adb:3:6-3:7> | ||
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
expected type: None | ||
Expr: <DottedName p1-p2-p3-p4.adb:15:11-15:15> | ||
references: <DefiningName "S" p1-p2-p3.adb:3:6-3:7> | ||
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
expected type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
Expr: <Id "P3" p1-p2-p3-p4.adb:15:11-15:13> | ||
references: <DefiningName "P3" p1-p2-p3.adb:2:11-2:13> | ||
type: None | ||
expected type: None | ||
Expr: <Id "S" p1-p2-p3-p4.adb:15:14-15:15> | ||
references: <DefiningName "S" p1-p2-p3.adb:3:6-3:7> | ||
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
expected type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57> | ||
|
||
Resolving xrefs for node <AssignStmt p1-p2-p3-p4.adb:18:6-18:16> | ||
**************************************************************** | ||
|
||
Expr: <Id "C" p1-p2-p3-p4.adb:18:6-18:7> | ||
references: <DefiningName "C" p1-p2-p3-p4.adb:4:6-4:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: None | ||
Expr: <DottedName p1-p2-p3-p4.adb:18:11-18:15> | ||
references: <DefiningName "C" p1-p2-p3.adb:4:6-4:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
Expr: <Id "P3" p1-p2-p3-p4.adb:18:11-18:13> | ||
references: <DefiningName "P3" p1-p2-p3.adb:2:11-2:13> | ||
type: None | ||
expected type: None | ||
Expr: <Id "C" p1-p2-p3-p4.adb:18:14-18:15> | ||
references: <DefiningName "C" p1-p2-p3.adb:4:6-4:7> | ||
type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
expected type: <ConcreteTypeDecl ["Character"] __standard:21:3-21:27> | ||
|
||
|
||
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: [p1-p2.adb, p1-p2-p3.adb, p1-p2-p3-p4.adb] |