-
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/1316' into 'master'
Implement TypeExpr.subtype_constraint property. Closes #1317 and #1316 See merge request eng/libadalang/libadalang!1573
- Loading branch information
Showing
7 changed files
with
189 additions
and
48 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
14 changes: 6 additions & 8 deletions
14
...s/properties/subtype_constraints/test.out → ...perties/discriminant_constraints/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 |
---|---|---|
@@ -1,37 +1,35 @@ | ||
Working on node <ComponentDecl ["Track1"] discr.adb:15:16-15:50> | ||
================================================================ | ||
|
||
Eval 'node.f_component_def.f_type_expr.p_subtype_constraints' | ||
Eval 'node.p_type_expression.p_discriminant_constraints' | ||
Result: [] | ||
|
||
Working on node <ObjectDecl ["P1"] discr.adb:21:4-21:20> | ||
======================================================== | ||
|
||
Eval 'node.f_type_expr.p_subtype_constraints' | ||
Result: [<ParamActual param=<DefiningName "Unit" discr.adb:7:20-7:24> actual=<Id "Disk" discr.adb:7:37-7:41>>, | ||
<ParamActual param=<DefiningName "Trk1" discr.adb:7:43-7:47> actual=<Int discr.adb:7:72-7:73>>, | ||
<ParamActual param=<DefiningName "Trk2" discr.adb:7:49-7:53> actual=<Int discr.adb:7:72-7:73>>] | ||
Eval 'node.f_type_expr.p_discriminant_constraints' | ||
Result: [] | ||
|
||
Working on node <ObjectDecl ["P2"] discr.adb:23:4-23:60> | ||
======================================================== | ||
|
||
Eval 'node.f_type_expr.p_subtype_constraints' | ||
Eval 'node.f_type_expr.p_discriminant_constraints' | ||
Result: [<ParamActual param=<DefiningName "Unit" discr.adb:7:20-7:24> actual=<Id "Printer" discr.adb:23:29-23:36>>, | ||
<ParamActual param=<DefiningName "Trk1" discr.adb:7:43-7:47> actual=<Int discr.adb:23:46-23:47>>, | ||
<ParamActual param=<DefiningName "Trk2" discr.adb:7:49-7:53> actual=<Int discr.adb:23:57-23:58>>] | ||
|
||
Working on node <ObjectDecl ["P3"] discr.adb:25:4-25:36> | ||
======================================================== | ||
|
||
Eval 'node.f_type_expr.p_subtype_constraints' | ||
Eval 'node.f_type_expr.p_discriminant_constraints' | ||
Result: [<ParamActual param=<DefiningName "Unit" discr.adb:7:20-7:24> actual=<Id "Printer" discr.adb:25:21-25:28>>, | ||
<ParamActual param=<DefiningName "Trk1" discr.adb:7:43-7:47> actual=<Int discr.adb:25:30-25:31>>, | ||
<ParamActual param=<DefiningName "Trk2" discr.adb:7:49-7:53> actual=<Int discr.adb:25:33-25:34>>] | ||
|
||
Working on node <ObjectDecl ["P4"] discr.adb:27:4-27:54> | ||
======================================================== | ||
|
||
Eval 'node.f_type_expr.p_subtype_constraints' | ||
Eval 'node.f_type_expr.p_discriminant_constraints' | ||
Result: [<ParamActual param=<DefiningName "Unit" discr.adb:7:20-7:24> actual=<Id "Printer" discr.adb:27:45-27:52>>, | ||
<ParamActual param=<DefiningName "Trk1" discr.adb:7:43-7:47> actual=<Int discr.adb:27:34-27:35>>, | ||
<ParamActual param=<DefiningName "Trk2" discr.adb:7:49-7:53> actual=<Int discr.adb:27:34-27:35>>] |
File renamed without changes.
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,61 @@ | ||
procedure Test is | ||
subtype My_Nat is Integer range 0 .. 100; | ||
|
||
type Arr is array (Integer range <>) of Integer; | ||
|
||
subtype Sub_Arr is Arr; | ||
subtype Nat_Arr is Sub_Arr (Natural); | ||
subtype Sub_Nat_Arr is Nat_Arr; | ||
|
||
type New_Nat_Arr is new Sub_Arr (Natural); | ||
|
||
type New_Arr is new Sub_Arr; | ||
|
||
subtype Nat_New_Arr is New_Arr (Natural); | ||
|
||
type Mat is array (Integer range <>, Integer range <>) of Integer; | ||
|
||
subtype Nat_Mat is Mat (Natural, Natural); | ||
|
||
type Vec_3 is array (1 .. 3) of Integer; | ||
|
||
type Discr_Rec (X, Y : Natural) is record | ||
K : Integer; | ||
end record; | ||
|
||
subtype Sub_Rec is Discr_Rec (X => 1, Y => 2); | ||
|
||
type Der_Rec is new Discr_Rec (X => 1, Y => 3); | ||
|
||
A : My_Nat; | ||
--% node.f_type_expr.p_subtype_constraint() | ||
|
||
B : Sub_Nat_Arr; | ||
--% node.f_type_expr.p_subtype_constraint() | ||
|
||
C : New_Nat_Arr; | ||
--% node.f_type_expr.p_subtype_constraint() | ||
|
||
D : Nat_New_Arr; | ||
--% node.f_type_expr.p_subtype_constraint() | ||
|
||
E : Nat_Mat; | ||
--% node.f_type_expr.p_subtype_constraint() | ||
|
||
F : Vec_3; | ||
--% node.f_type_expr.p_subtype_constraint() | ||
|
||
G : Sub_Rec; | ||
--% node.f_type_expr.p_subtype_constraint() | ||
|
||
H : My_Nat range 1 .. 10; | ||
--% node.f_type_expr.p_subtype_constraint() | ||
|
||
I : Sub_Arr (1 .. 3); | ||
--% node.f_type_expr.p_subtype_constraint() | ||
|
||
J : Discr_Rec (X => 1, Y => 4); | ||
--% node.f_type_expr.p_subtype_constraint() | ||
begin | ||
null; | ||
end Test; |
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,59 @@ | ||
Working on node <ObjectDecl ["A"] test.adb:30:4-30:15> | ||
====================================================== | ||
|
||
Eval 'node.f_type_expr.p_subtype_constraint()' | ||
Result: <RangeConstraint test.adb:2:30-2:44> | ||
|
||
Working on node <ObjectDecl ["B"] test.adb:33:4-33:20> | ||
====================================================== | ||
|
||
Eval 'node.f_type_expr.p_subtype_constraint()' | ||
Result: <CompositeConstraint test.adb:7:31-7:40> | ||
|
||
Working on node <ObjectDecl ["C"] test.adb:36:4-36:20> | ||
====================================================== | ||
|
||
Eval 'node.f_type_expr.p_subtype_constraint()' | ||
Result: None | ||
|
||
Working on node <ObjectDecl ["D"] test.adb:39:4-39:20> | ||
====================================================== | ||
|
||
Eval 'node.f_type_expr.p_subtype_constraint()' | ||
Result: <CompositeConstraint test.adb:14:35-14:44> | ||
|
||
Working on node <ObjectDecl ["E"] test.adb:42:4-42:16> | ||
====================================================== | ||
|
||
Eval 'node.f_type_expr.p_subtype_constraint()' | ||
Result: <CompositeConstraint test.adb:18:27-18:45> | ||
|
||
Working on node <ObjectDecl ["F"] test.adb:45:4-45:14> | ||
====================================================== | ||
|
||
Eval 'node.f_type_expr.p_subtype_constraint()' | ||
Result: None | ||
|
||
Working on node <ObjectDecl ["G"] test.adb:48:4-48:16> | ||
====================================================== | ||
|
||
Eval 'node.f_type_expr.p_subtype_constraint()' | ||
Result: <CompositeConstraint test.adb:26:33-26:49> | ||
|
||
Working on node <ObjectDecl ["H"] test.adb:51:4-51:29> | ||
====================================================== | ||
|
||
Eval 'node.f_type_expr.p_subtype_constraint()' | ||
Result: <RangeConstraint test.adb:51:15-51:28> | ||
|
||
Working on node <ObjectDecl ["I"] test.adb:54:4-54:25> | ||
====================================================== | ||
|
||
Eval 'node.f_type_expr.p_subtype_constraint()' | ||
Result: <CompositeConstraint test.adb:54:16-54:24> | ||
|
||
Working on node <ObjectDecl ["J"] test.adb:57:4-57:35> | ||
====================================================== | ||
|
||
Eval 'node.f_type_expr.p_subtype_constraint()' | ||
Result: <CompositeConstraint test.adb:57:18-57:34> |
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] |