-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'sync/fix_rebindings' into 'master'
Multiple fixes for nameres bugs when traversing generic instantiations. Closes #1220, #1221, #1226, and #1306 See merge request eng/libadalang/libadalang!1630
- Loading branch information
Showing
41 changed files
with
2,434 additions
and
75 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
testsuite/tests/name_resolution/attr_function_from_generic/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,22 @@ | ||
procedure Test is | ||
generic | ||
type T is (<>); | ||
package Fail_G is | ||
function F (E : T) return T is (T'Val (1)); | ||
end Fail_G; | ||
|
||
generic | ||
package Level_1 is | ||
generic | ||
type Type_T is (<>); | ||
package Level_2 is | ||
package Inst is new Fail_G (Type_T); | ||
end Level_2; | ||
end Level_1; | ||
|
||
package Origin is new Level_1; | ||
pragma Test_Statement; | ||
begin | ||
null; | ||
end Test; | ||
|
118 changes: 118 additions & 0 deletions
118
testsuite/tests/name_resolution/attr_function_from_generic/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,118 @@ | ||
Analyzing test.adb | ||
################## | ||
|
||
Resolving xrefs for node <GenericPackageInstantiation ["Origin"] test.adb:17:4-17:34> | ||
************************************************************************************* | ||
|
||
Expr: <Id "Level_1" test.adb:17:26-17:33> | ||
references: <DefiningName "Level_1" test.adb:9:12-9:19> | ||
type: None | ||
expected type: None | ||
Traversing generic node <| GenericPackageDecl ["Level_1"] test.adb:8:4-15:16 [test.adb:17:4] |> | ||
*********************************************************************************************** | ||
|
||
Resolving xrefs for node <| FormalTypeDecl ["Type_T"] test.adb:11:10-11:30 [test.adb:17:4] |> | ||
********************************************************************************************* | ||
|
||
|
||
Resolving xrefs for node <| GenericPackageInstantiation ["Inst"] test.adb:13:10-13:46 [test.adb:17:4] |> | ||
******************************************************************************************************** | ||
|
||
Expr: <| Id "Fail_G" test.adb:13:30-13:36 [test.adb:17:4] |> | ||
references: <DefiningName "Fail_G" test.adb:4:12-4:18> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "Type_T" test.adb:13:38-13:44 [test.adb:17:4] |> | ||
references: <| DefiningName "Type_T" test.adb:11:15-11:21 [test.adb:17:4] |> | ||
type: None | ||
expected type: None | ||
Traversing generic node <| GenericPackageDecl ["Fail_G"] test.adb:2:4-6:15 [test.adb:17:4, test.adb:13:10] |> | ||
************************************************************************************************************* | ||
|
||
Resolving xrefs for node <| FormalTypeDecl ["T"] test.adb:3:7-3:22 [test.adb:17:4, test.adb:13:10] |> | ||
***************************************************************************************************** | ||
|
||
|
||
Resolving xrefs for node <| ExprFunction ["F"] test.adb:5:7-5:50 [test.adb:17:4, test.adb:13:10] |> | ||
*************************************************************************************************** | ||
|
||
Expr: <| ParenExpr test.adb:5:38-5:49 [test.adb:17:4, test.adb:13:10] |> | ||
type: <| FormalTypeDecl ["Type_T"] test.adb:11:10-11:30 [test.adb:17:4] |> | ||
expected type: <| FormalTypeDecl ["Type_T"] test.adb:11:10-11:30 [test.adb:17:4] |> | ||
Expr: <| CallExpr test.adb:5:39-5:48 [test.adb:17:4, test.adb:13:10] |> | ||
references: <| SyntheticDefiningName "val" test.adb:11:10-11:30 [test.adb:17:4] |> | ||
type: <| FormalTypeDecl ["Type_T"] test.adb:11:10-11:30 [test.adb:17:4] |> | ||
expected type: <| FormalTypeDecl ["Type_T"] test.adb:11:10-11:30 [test.adb:17:4] |> | ||
Expr: <| AttributeRef test.adb:5:39-5:44 [test.adb:17:4, test.adb:13:10] |> | ||
references: <| SyntheticDefiningName "val" test.adb:11:10-11:30 [test.adb:17:4] |> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "T" test.adb:5:39-5:40 [test.adb:17:4, test.adb:13:10] |> | ||
references: <| DefiningName "Type_T" test.adb:11:15-11:21 [test.adb:17:4] |> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "Val" test.adb:5:41-5:44 [test.adb:17:4, test.adb:13:10] |> | ||
references: None | ||
type: None | ||
expected type: None | ||
Expr: <| Int test.adb:5:46-5:47 [test.adb:17:4, test.adb:13:10] |> | ||
references: None | ||
type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
expected type: <ConcreteTypeDecl ["Universal_Int_Type_"] __standard:116:3-116:45> | ||
|
||
Resolving xrefs for node <| SubpSpec test.adb:5:7-5:34 [test.adb:17:4, test.adb:13:10] |> | ||
***************************************************************************************** | ||
|
||
Expr: <| Id "T" test.adb:5:33-5:34 [test.adb:17:4, test.adb:13:10] |> | ||
references: <| DefiningName "Type_T" test.adb:11:15-11:21 [test.adb:17:4] |> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <| ParamSpec ["E"] test.adb:5:19-5:24 [test.adb:17:4, test.adb:13:10] |> | ||
************************************************************************************************* | ||
|
||
Expr: <| Id "T" test.adb:5:23-5:24 [test.adb:17:4, test.adb:13:10] |> | ||
references: <| DefiningName "Type_T" test.adb:11:15-11:21 [test.adb:17:4] |> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <| EndName test.adb:6:8-6:14 [test.adb:17:4, test.adb:13:10] |> | ||
**************************************************************************************** | ||
|
||
Expr: <| EndName test.adb:6:8-6:14 [test.adb:17:4, test.adb:13:10] |> | ||
references: <| DefiningName "Inst" test.adb:13:18-13:22 [test.adb:17:4] |> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "Fail_G" test.adb:6:8-6:14 [test.adb:17:4, test.adb:13:10] |> | ||
references: <| DefiningName "Inst" test.adb:13:18-13:22 [test.adb:17:4] |> | ||
type: None | ||
expected type: None | ||
|
||
|
||
Resolving xrefs for node <| EndName test.adb:14:11-14:18 [test.adb:17:4] |> | ||
*************************************************************************** | ||
|
||
Expr: <| EndName test.adb:14:11-14:18 [test.adb:17:4] |> | ||
references: <| DefiningName "Level_2" test.adb:12:15-12:22 [test.adb:17:4] |> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "Level_2" test.adb:14:11-14:18 [test.adb:17:4] |> | ||
references: <| DefiningName "Level_2" test.adb:12:15-12:22 [test.adb:17:4] |> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <| EndName test.adb:15:8-15:15 [test.adb:17:4] |> | ||
************************************************************************** | ||
|
||
Expr: <| EndName test.adb:15:8-15:15 [test.adb:17:4] |> | ||
references: <DefiningName "Origin" test.adb:17:12-17:18> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "Level_1" test.adb:15:8-15:15 [test.adb:17:4] |> | ||
references: <DefiningName "Origin" test.adb:17:12-17:18> | ||
type: None | ||
expected type: None | ||
|
||
|
||
|
||
Done. |
3 changes: 3 additions & 0 deletions
3
testsuite/tests/name_resolution/attr_function_from_generic/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,3 @@ | ||
driver: name-resolution | ||
traverse_generics: true | ||
input_sources: [test.adb] |
37 changes: 37 additions & 0 deletions
37
testsuite/tests/name_resolution/collapse_rebindings/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,37 @@ | ||
procedure Test is | ||
generic | ||
type P is private; | ||
package Base_G is | ||
type T is tagged null record; | ||
|
||
procedure Foo (X : T; Y : P) is null; | ||
end Base_G; | ||
|
||
generic | ||
with package Base is new Base_G (<>); | ||
package Concrete_G is | ||
generic | ||
type U is new Base.T with private; | ||
package Inner_G is | ||
type V is new U with null record; | ||
|
||
procedure Test (X : V; Y : Base.P); | ||
end Inner_G; | ||
end Concrete_G; | ||
|
||
package body Concrete_G is | ||
package body Inner_G is | ||
procedure Test (X : V; Y : Base.P) is | ||
begin | ||
Foo (U (X), Y); | ||
end Test; | ||
end Inner_G; | ||
end Concrete_G; | ||
|
||
package My_Base is new Base_G (Integer); | ||
package My_Concrete is new Concrete_G (My_Base); | ||
package My_Inner is new My_Concrete.Inner_G (My_Base.T); | ||
pragma Test_Statement; | ||
begin | ||
null; | ||
end Test; |
183 changes: 183 additions & 0 deletions
183
testsuite/tests/name_resolution/collapse_rebindings/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,183 @@ | ||
Analyzing test.adb | ||
################## | ||
|
||
Resolving xrefs for node <GenericPackageInstantiation ["My_Inner"] test.adb:33:4-33:60> | ||
*************************************************************************************** | ||
|
||
Expr: <DottedName test.adb:33:28-33:47> | ||
references: <| DefiningName "Inner_G" test.adb:15:15-15:22 [test.adb:32:4] |> | ||
type: None | ||
expected type: None | ||
Expr: <Id "My_Concrete" test.adb:33:28-33:39> | ||
references: <DefiningName "My_Concrete" test.adb:32:12-32:23> | ||
type: None | ||
expected type: None | ||
Expr: <Id "Inner_G" test.adb:33:40-33:47> | ||
references: <| DefiningName "Inner_G" test.adb:15:15-15:22 [test.adb:32:4] |> | ||
type: None | ||
expected type: None | ||
Expr: <DottedName test.adb:33:49-33:58> | ||
references: <| DefiningName "T" test.adb:5:12-5:13 [test.adb:31:4] |> | ||
type: None | ||
expected type: None | ||
Expr: <Id "My_Base" test.adb:33:49-33:56> | ||
references: <DefiningName "My_Base" test.adb:31:12-31:19> | ||
type: None | ||
expected type: None | ||
Expr: <Id "T" test.adb:33:57-33:58> | ||
references: <| DefiningName "T" test.adb:5:12-5:13 [test.adb:31:4] |> | ||
type: None | ||
expected type: None | ||
Traversing generic node <| GenericPackageDecl ["Inner_G"] test.adb:13:7-19:19 [test.adb:32:4, test.adb:33:4] |> | ||
*************************************************************************************************************** | ||
|
||
Resolving xrefs for node <| FormalTypeDecl ["U"] test.adb:14:10-14:44 [test.adb:32:4, test.adb:33:4] |> | ||
******************************************************************************************************* | ||
|
||
Expr: <| DottedName test.adb:14:24-14:30 [test.adb:32:4, test.adb:33:4] |> | ||
references: <| DefiningName "T" test.adb:5:12-5:13 [test.adb:31:4] |> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "Base" test.adb:14:24-14:28 [test.adb:32:4, test.adb:33:4] |> | ||
references: <DefiningName "My_Base" test.adb:31:12-31:19> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "T" test.adb:14:29-14:30 [test.adb:32:4, test.adb:33:4] |> | ||
references: <| DefiningName "T" test.adb:5:12-5:13 [test.adb:31:4] |> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <| ConcreteTypeDecl ["V"] test.adb:16:10-16:43 [test.adb:32:4, test.adb:33:4] |> | ||
********************************************************************************************************* | ||
|
||
Expr: <| Id "U" test.adb:16:24-16:25 [test.adb:32:4, test.adb:33:4] |> | ||
references: <| DefiningName "T" test.adb:5:12-5:13 [test.adb:31:4] |> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <| SubpSpec test.adb:18:10-18:44 [test.adb:32:4, test.adb:33:4] |> | ||
******************************************************************************************* | ||
|
||
|
||
Resolving xrefs for node <| ParamSpec ["X"] test.adb:18:26-18:31 [test.adb:32:4, test.adb:33:4] |> | ||
************************************************************************************************** | ||
|
||
Expr: <| Id "V" test.adb:18:30-18:31 [test.adb:32:4, test.adb:33:4] |> | ||
references: <| DefiningName "V" test.adb:16:15-16:16 [test.adb:32:4, test.adb:33:4] |> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <| ParamSpec ["Y"] test.adb:18:33-18:43 [test.adb:32:4, test.adb:33:4] |> | ||
************************************************************************************************** | ||
|
||
Expr: <| DottedName test.adb:18:37-18:43 [test.adb:32:4, test.adb:33:4] |> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "Base" test.adb:18:37-18:41 [test.adb:32:4, test.adb:33:4] |> | ||
references: <DefiningName "My_Base" test.adb:31:12-31:19> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "P" test.adb:18:42-18:43 [test.adb:32:4, test.adb:33:4] |> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <| EndName test.adb:19:11-19:18 [test.adb:32:4, test.adb:33:4] |> | ||
****************************************************************************************** | ||
|
||
Expr: <| EndName test.adb:19:11-19:18 [test.adb:32:4, test.adb:33:4] |> | ||
references: <DefiningName "My_Inner" test.adb:33:12-33:20> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "Inner_G" test.adb:19:11-19:18 [test.adb:32:4, test.adb:33:4] |> | ||
references: <DefiningName "My_Inner" test.adb:33:12-33:20> | ||
type: None | ||
expected type: None | ||
|
||
Traversing generic node <| PackageBody ["Inner_G"] test.adb:23:7-28:19 [test.adb:32:4, test.adb:33:4] |> | ||
******************************************************************************************************** | ||
|
||
Resolving xrefs for node <| SubpSpec test.adb:24:10-24:44 [test.adb:32:4, test.adb:33:4] |> | ||
******************************************************************************************* | ||
|
||
|
||
Resolving xrefs for node <| ParamSpec ["X"] test.adb:24:26-24:31 [test.adb:32:4, test.adb:33:4] |> | ||
************************************************************************************************** | ||
|
||
Expr: <| Id "V" test.adb:24:30-24:31 [test.adb:32:4, test.adb:33:4] |> | ||
references: <| DefiningName "V" test.adb:16:15-16:16 [test.adb:32:4, test.adb:33:4] |> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <| ParamSpec ["Y"] test.adb:24:33-24:43 [test.adb:32:4, test.adb:33:4] |> | ||
************************************************************************************************** | ||
|
||
Expr: <| DottedName test.adb:24:37-24:43 [test.adb:32:4, test.adb:33:4] |> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "Base" test.adb:24:37-24:41 [test.adb:32:4, test.adb:33:4] |> | ||
references: <DefiningName "My_Base" test.adb:31:12-31:19> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "P" test.adb:24:42-24:43 [test.adb:32:4, test.adb:33:4] |> | ||
references: <DefiningName "Integer" __standard:4:8-4:15> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <| CallStmt test.adb:26:13-26:28 [test.adb:32:4, test.adb:33:4] |> | ||
******************************************************************************************* | ||
|
||
Expr: <| CallExpr test.adb:26:13-26:27 [test.adb:32:4, test.adb:33:4] |> | ||
references: <| DefiningName "Foo" test.adb:7:17-7:20 [test.adb:32:4, test.adb:33:4] |> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "Foo" test.adb:26:13-26:16 [test.adb:32:4, test.adb:33:4] |> | ||
references: <| DefiningName "Foo" test.adb:7:17-7:20 [test.adb:32:4, test.adb:33:4] |> | ||
type: None | ||
expected type: None | ||
Expr: <| CallExpr test.adb:26:18-26:23 [test.adb:32:4, test.adb:33:4] |> | ||
references: <| DefiningName "T" test.adb:5:12-5:13 [test.adb:31:4] |> | ||
type: <| ConcreteTypeDecl ["T"] test.adb:5:7-5:36 [test.adb:31:4] |> | ||
expected type: <| ConcreteTypeDecl ["T"] test.adb:5:7-5:36 [test.adb:31:4] |> | ||
Expr: <| Id "U" test.adb:26:18-26:19 [test.adb:32:4, test.adb:33:4] |> | ||
references: <| DefiningName "T" test.adb:5:12-5:13 [test.adb:31:4] |> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "X" test.adb:26:21-26:22 [test.adb:32:4, test.adb:33:4] |> | ||
references: <| DefiningName "X" test.adb:24:26-24:27 [test.adb:32:4, test.adb:33:4] |> | ||
type: <| ConcreteTypeDecl ["V"] test.adb:16:10-16:43 [test.adb:32:4, test.adb:33:4] |> | ||
expected type: None | ||
Expr: <| Id "Y" test.adb:26:25-26:26 [test.adb:32:4, test.adb:33:4] |> | ||
references: <| DefiningName "Y" test.adb:24:33-24:34 [test.adb:32:4, test.adb:33:4] |> | ||
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54> | ||
|
||
Resolving xrefs for node <| EndName test.adb:27:14-27:18 [test.adb:32:4, test.adb:33:4] |> | ||
****************************************************************************************** | ||
|
||
Expr: <| EndName test.adb:27:14-27:18 [test.adb:32:4, test.adb:33:4] |> | ||
references: <| DefiningName "Test" test.adb:24:20-24:24 [test.adb:32:4, test.adb:33:4] |> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "Test" test.adb:27:14-27:18 [test.adb:32:4, test.adb:33:4] |> | ||
references: <| DefiningName "Test" test.adb:24:20-24:24 [test.adb:32:4, test.adb:33:4] |> | ||
type: None | ||
expected type: None | ||
|
||
Resolving xrefs for node <| EndName test.adb:28:11-28:18 [test.adb:32:4, test.adb:33:4] |> | ||
****************************************************************************************** | ||
|
||
Expr: <| EndName test.adb:28:11-28:18 [test.adb:32:4, test.adb:33:4] |> | ||
references: <| DefiningName "Inner_G" test.adb:23:20-23:27 [test.adb:32:4, test.adb:33:4] |> | ||
type: None | ||
expected type: None | ||
Expr: <| Id "Inner_G" test.adb:28:11-28:18 [test.adb:32:4, test.adb:33:4] |> | ||
references: <| DefiningName "Inner_G" test.adb:23:20-23:27 [test.adb:32:4, test.adb:33:4] |> | ||
type: None | ||
expected type: None | ||
|
||
|
||
|
||
Done. |
3 changes: 3 additions & 0 deletions
3
testsuite/tests/name_resolution/collapse_rebindings/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,3 @@ | ||
driver: name-resolution | ||
traverse_generics: true | ||
input_sources: [test.adb] |
Oops, something went wrong.