-
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/1381' into 'master'
Fix name resolution of assocs in declare expression env Closes #1381 See merge request eng/libadalang/libadalang!1653
- Loading branch information
Showing
7 changed files
with
207 additions
and
67 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
29 changes: 29 additions & 0 deletions
29
testsuite/tests/name_resolution/declare_expr_aggregate/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,29 @@ | ||
pragma Ada_2022; | ||
|
||
procedure Test is | ||
type A is array (Natural range 0 .. 1) of Integer; | ||
|
||
function F return A is | ||
(declare | ||
I : constant Integer := 0; | ||
J : constant Integer := 1; | ||
begin (I, J)); | ||
pragma Test_Statement; | ||
|
||
function G return Integer is | ||
(declare | ||
K : constant Integer := 2; | ||
begin (K)); | ||
pragma Test_Statement; | ||
|
||
type B is array (Natural range 0 .. 1) of A; | ||
K : Integer := 3; | ||
|
||
function H return B is | ||
(declare | ||
K : constant Integer := 2; | ||
begin (B'First => (K, K), B'Last => (K, K))); | ||
pragma Test_Statement; | ||
begin | ||
null; | ||
end; |
102 changes: 102 additions & 0 deletions
102
testsuite/tests/name_resolution/declare_expr_aggregate/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,102 @@ | ||
Analyzing test.adb | ||
################## | ||
|
||
Resolving xrefs for node <ExprFunction ["F"] test.adb:6:4-10:21> | ||
**************************************************************** | ||
|
||
Expr: <ParenExpr test.adb:7:6-10:20> | ||
type: <ConcreteTypeDecl ["A"] test.adb:4:4-4:54> | ||
expected type: <ConcreteTypeDecl ["A"] test.adb:4:4-4:54> | ||
Expr: <DeclExpr test.adb:7:7-10:19> | ||
type: <ConcreteTypeDecl ["A"] test.adb:4:4-4:54> | ||
expected type: <ConcreteTypeDecl ["A"] test.adb:4:4-4:54> | ||
Expr: <Aggregate test.adb:10:13-10:19> | ||
type: <ConcreteTypeDecl ["A"] test.adb:4:4-4:54> | ||
expected type: <ConcreteTypeDecl ["A"] test.adb:4:4-4:54> | ||
Expr: <Id "I" test.adb:10:14-10:15> | ||
references: <DefiningName "I" test.adb:8:9-8:10> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <Id "J" test.adb:10:17-10:18> | ||
references: <DefiningName "J" test.adb:9:9-9:10> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
|
||
Resolving xrefs for node <ExprFunction ["G"] test.adb:13:4-16:18> | ||
***************************************************************** | ||
|
||
Expr: <ParenExpr test.adb:14:6-16:17> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <DeclExpr test.adb:14:7-16:16> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <ParenExpr test.adb:16:13-16:16> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <Id "K" test.adb:16:14-16:15> | ||
references: <DefiningName "K" test.adb:15:9-15:10> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
|
||
Resolving xrefs for node <ExprFunction ["H"] test.adb:22:4-25:52> | ||
***************************************************************** | ||
|
||
Expr: <ParenExpr test.adb:23:6-25:51> | ||
type: <ConcreteTypeDecl ["B"] test.adb:19:4-19:48> | ||
expected type: <ConcreteTypeDecl ["B"] test.adb:19:4-19:48> | ||
Expr: <DeclExpr test.adb:23:7-25:50> | ||
type: <ConcreteTypeDecl ["B"] test.adb:19:4-19:48> | ||
expected type: <ConcreteTypeDecl ["B"] test.adb:19:4-19:48> | ||
Expr: <Aggregate test.adb:25:13-25:50> | ||
type: <ConcreteTypeDecl ["B"] test.adb:19:4-19:48> | ||
expected type: <ConcreteTypeDecl ["B"] test.adb:19:4-19:48> | ||
Expr: <AttributeRef test.adb:25:14-25:21> | ||
references: None | ||
type: <SubtypeDecl ["Natural"] __standard:5:3-5:57> | ||
expected type: <SubtypeDecl ["Natural"] __standard:5:3-5:57> | ||
Expr: <Id "B" test.adb:25:14-25:15> | ||
references: <DefiningName "B" test.adb:19:9-19:10> | ||
type: None | ||
expected type: None | ||
Expr: <Id "First" test.adb:25:16-25:21> | ||
references: None | ||
type: None | ||
expected type: None | ||
Expr: <Aggregate test.adb:25:25-25:31> | ||
type: <ConcreteTypeDecl ["A"] test.adb:4:4-4:54> | ||
expected type: <ConcreteTypeDecl ["A"] test.adb:4:4-4:54> | ||
Expr: <Id "K" test.adb:25:26-25:27> | ||
references: <DefiningName "K" test.adb:24:9-24:10> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <Id "K" test.adb:25:29-25:30> | ||
references: <DefiningName "K" test.adb:24:9-24:10> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <AttributeRef test.adb:25:33-25:39> | ||
references: None | ||
type: <SubtypeDecl ["Natural"] __standard:5:3-5:57> | ||
expected type: <SubtypeDecl ["Natural"] __standard:5:3-5:57> | ||
Expr: <Id "B" test.adb:25:33-25:34> | ||
references: <DefiningName "B" test.adb:19:9-19:10> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Last" test.adb:25:35-25:39> | ||
references: None | ||
type: None | ||
expected type: None | ||
Expr: <Aggregate test.adb:25:43-25:49> | ||
type: <ConcreteTypeDecl ["A"] test.adb:4:4-4:54> | ||
expected type: <ConcreteTypeDecl ["A"] test.adb:4:4-4:54> | ||
Expr: <Id "K" test.adb:25:44-25:45> | ||
references: <DefiningName "K" test.adb:24:9-24:10> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
Expr: <Id "K" test.adb:25:47-25:48> | ||
references: <DefiningName "K" test.adb:24:9-24:10> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
|
||
|
||
Done. |
2 changes: 2 additions & 0 deletions
2
testsuite/tests/name_resolution/declare_expr_aggregate/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] |
23 changes: 23 additions & 0 deletions
23
testsuite/tests/name_resolution/declare_expr_aggregate_2/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,23 @@ | ||
pragma Ada_2022; | ||
|
||
procedure Test is | ||
type A is array (Natural range 0 .. 1) of Integer; | ||
|
||
function F return A is | ||
(declare | ||
I : constant Integer := 0; | ||
J : constant Integer := 1; | ||
begin (I, J)); | ||
--% node.findall(lal.AggregateAssoc)[0].f_r_expr.p_referenced_decl() | ||
|
||
type B is array (Natural range 0 .. 1) of A; | ||
K : Integer := 3; | ||
|
||
function H return B is | ||
(declare | ||
K : constant Integer := 2; | ||
begin (B'First => (K, K), B'Last => (K, K))); | ||
--% node.findall(lal.AggregateAssoc)[-1].f_r_expr.p_referenced_decl() | ||
begin | ||
null; | ||
end; |
11 changes: 11 additions & 0 deletions
11
testsuite/tests/name_resolution/declare_expr_aggregate_2/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,11 @@ | ||
Working on node <ExprFunction ["F"] test.adb:6:4-10:21> | ||
======================================================= | ||
|
||
Eval 'node.findall(lal.AggregateAssoc)[0].f_r_expr.p_referenced_decl()' | ||
Result: <ObjectDecl ["I"] test.adb:8:9-8:35> | ||
|
||
Working on node <ExprFunction ["H"] test.adb:16:4-19:52> | ||
======================================================== | ||
|
||
Eval 'node.findall(lal.AggregateAssoc)[-1].f_r_expr.p_referenced_decl()' | ||
Result: <ObjectDecl ["K"] test.adb:18:9-18:35> |
2 changes: 2 additions & 0 deletions
2
testsuite/tests/name_resolution/declare_expr_aggregate_2/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: inline-playground | ||
input_sources: [test.adb] |