-
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/1117' into 'master'
Avoid more crashes on illegal self references Closes #1117, #1122, and #1123 See merge request eng/libadalang/libadalang!1447
- Loading branch information
Showing
6 changed files
with
203 additions
and
46 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
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
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
33 changes: 33 additions & 0 deletions
33
testsuite/tests/name_resolution/record_self_access/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,33 @@ | ||
procedure Test is | ||
type P is tagged null record; | ||
type T is new P with record | ||
X : access T; | ||
--% access_type = node.f_component_def.f_type_expr.f_type_decl | ||
--% access_type.f_type_def.f_subtype_indication.p_designated_type_decl | ||
--% access_type.f_type_def.f_subtype_indication.f_name.p_referenced_decl() | ||
end record; | ||
|
||
type T_2 is new P with record | ||
X : access T_2 := T_2'Unrestricted_Access; | ||
--% access_type = node.f_component_def.f_type_expr.f_type_decl | ||
--% access_type.f_type_def.f_subtype_indication.f_name.p_referenced_decl() | ||
--% access_type.f_type_def.f_subtype_indication.p_designated_type_decl | ||
--% node.f_default_expr.f_prefix.p_referenced_decl() | ||
end record; | ||
|
||
type A is record | ||
B : Integer; | ||
end record; | ||
|
||
type B is new A; | ||
|
||
procedure Assign (X : in out B; Y : B) is | ||
begin | ||
X.B := Y.B; | ||
--% node.f_dest.f_suffix.p_referenced_decl() | ||
--% node.f_expr.f_suffix.p_referenced_decl() | ||
end Assign; | ||
begin | ||
null; | ||
end Test; | ||
|
35 changes: 35 additions & 0 deletions
35
testsuite/tests/name_resolution/record_self_access/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,35 @@ | ||
Working on node <ComponentDecl ["X"] test.adb:4:7-4:20> | ||
======================================================= | ||
|
||
Set 'access_type' to 'node.f_component_def.f_type_expr.f_type_decl' | ||
Result: <AnonymousTypeDecl ["None"] test.adb:4:11-4:19> | ||
|
||
Eval 'access_type.f_type_def.f_subtype_indication.p_designated_type_decl' | ||
Result: <ConcreteTypeDecl ["T"] test.adb:3:4-8:15> | ||
|
||
Eval 'access_type.f_type_def.f_subtype_indication.f_name.p_referenced_decl()' | ||
Result: <ConcreteTypeDecl ["T"] test.adb:3:4-8:15> | ||
|
||
Working on node <ComponentDecl ["X"] test.adb:11:7-11:49> | ||
========================================================= | ||
|
||
Set 'access_type' to 'node.f_component_def.f_type_expr.f_type_decl' | ||
Result: <AnonymousTypeDecl ["None"] test.adb:11:11-11:21> | ||
|
||
Eval 'access_type.f_type_def.f_subtype_indication.f_name.p_referenced_decl()' | ||
Result: <ConcreteTypeDecl ["T_2"] test.adb:10:4-16:15> | ||
|
||
Eval 'access_type.f_type_def.f_subtype_indication.p_designated_type_decl' | ||
Result: <ConcreteTypeDecl ["T_2"] test.adb:10:4-16:15> | ||
|
||
Eval 'node.f_default_expr.f_prefix.p_referenced_decl()' | ||
Result: <SyntheticTypePredicateObjectDecl ["T_2"] test.adb:10:4-16:15> | ||
|
||
Working on node <AssignStmt test.adb:26:7-26:18> | ||
================================================ | ||
|
||
Eval 'node.f_dest.f_suffix.p_referenced_decl()' | ||
Result: <ComponentDecl ["B"] test.adb:19:7-19:19> | ||
|
||
Eval 'node.f_expr.f_suffix.p_referenced_decl()' | ||
Result: <ComponentDecl ["B"] test.adb:19:7-19:19> |
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] |