-
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.
Rework xref equations of type expressions
This change adds a new property: xref_type_equation, reworking xref_no_overloading for types name resolution. The goal is to unify xref equations and designated_type properties behavior when resolving types.
- Loading branch information
Showing
6 changed files
with
92 additions
and
40 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
6 changes: 6 additions & 0 deletions
6
testsuite/tests/name_resolution/designated_type_is_referenced_type/pkg-sub.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,6 @@ | ||
package body Pkg.Sub is | ||
procedure P (X : T) is | ||
begin | ||
null; | ||
end P; | ||
end Pkg.Sub; |
8 changes: 8 additions & 0 deletions
8
testsuite/tests/name_resolution/designated_type_is_referenced_type/pkg-sub.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,8 @@ | ||
package Pkg.Sub is | ||
procedure P (X : T); | ||
--% type_expr=node.find(lal.TypeExpr) | ||
--% designated_type=type_expr.p_designated_type_decl | ||
--% referenced_type=type_expr.p_type_name.p_referenced_decl() | ||
-- designated_type should be equal to referenced_type | ||
--% designated_type is referenced_type | ||
end Pkg.Sub; |
5 changes: 5 additions & 0 deletions
5
testsuite/tests/name_resolution/designated_type_is_referenced_type/pkg.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,5 @@ | ||
package Pkg is | ||
type T is private; | ||
private | ||
type T is null record; | ||
end Pkg; |
14 changes: 14 additions & 0 deletions
14
testsuite/tests/name_resolution/designated_type_is_referenced_type/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,14 @@ | ||
Working on node <SubpDecl ["P"] pkg-sub.ads:2:4-2:24> | ||
===================================================== | ||
|
||
Set 'type_expr' to 'node.find(lal.TypeExpr)' | ||
Result: <SubtypeIndication pkg-sub.ads:2:21-2:22> | ||
|
||
Set 'designated_type' to 'type_expr.p_designated_type_decl' | ||
Result: <ConcreteTypeDecl ["T"] pkg.ads:2:4-2:22> | ||
|
||
Set 'referenced_type' to 'type_expr.p_type_name.p_referenced_decl()' | ||
Result: <ConcreteTypeDecl ["T"] pkg.ads:2:4-2:22> | ||
|
||
Eval 'designated_type is referenced_type' | ||
Result: True |
2 changes: 2 additions & 0 deletions
2
testsuite/tests/name_resolution/designated_type_is_referenced_type/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: [pkg-sub.ads] |