Skip to content

Commit

Permalink
Merge branch 'topic/1377' into 'master'
Browse files Browse the repository at this point in the history
A type conversion's type reference does not have a type.

Closes #1377

See merge request eng/libadalang/libadalang!1634
  • Loading branch information
Roldak committed Apr 25, 2024
2 parents b951e15 + 08267a7 commit 394a2ac
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 23 deletions.
1 change: 0 additions & 1 deletion ada/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -16459,7 +16459,6 @@ def type_conv_self_xref_equation():
"""
return And(
Entity.name.subtype_indication_equation,
Bind(Self.name.ref_var, Self.name.type_var),
Bind(Self.type_var, Self.name.ref_var)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Expr: <CallExpr test.adb:7:9-7:25>
expected type: None
Expr: <Id "Array_Type" test.adb:7:9-7:19>
references: <DefiningName "Array_Type" test.adb:2:9-2:19>
type: <ConcreteTypeDecl ["Array_Type"] test.adb:2:4-2:59>
type: None
expected type: None
Expr: <Id "Arr" test.adb:7:21-7:24>
references: <DefiningName "Arr" test.adb:4:4-4:7>
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/name_resolution/attr_function_3/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Expr: <CallExpr test.adb:13:19-13:47>
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
Expr: <Id "Integer" test.adb:13:19-13:26>
references: <DefiningName "Integer" __standard:4:8-4:15>
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
type: None
expected type: None
Expr: <CallExpr test.adb:13:28-13:46>
references: <| SyntheticDefiningName "value" test.adb:4:7-4:31 [test.adb:7:4] |>
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/name_resolution/base_attr/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Expr: <CallExpr test.adb:5:18-5:29>
expected type: <DiscreteBaseSubtypeDecl ["T"] test.adb:2:4-2:40>
Expr: <AttributeRef test.adb:5:18-5:24>
references: <DefiningName "T" test.adb:2:9-2:10>
type: <DiscreteBaseSubtypeDecl ["T"] test.adb:2:4-2:40>
type: None
expected type: None
Expr: <Id "T" test.adb:5:18-5:19>
references: <DefiningName "T" test.adb:2:9-2:10>
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/name_resolution/cw_conversion/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Expr: <CallExpr testcwconv.adb:8:9-8:22>
expected type: <ClasswideTypeDecl ["T"] testcwconv.adb:2:4-2:33>
Expr: <AttributeRef testcwconv.adb:8:9-8:16>
references: <DefiningName "T" testcwconv.adb:2:9-2:10>
type: <ClasswideTypeDecl ["T"] testcwconv.adb:2:4-2:33>
type: None
expected type: None
Expr: <Id "T" testcwconv.adb:8:9-8:10>
references: <DefiningName "T" testcwconv.adb:2:9-2:10>
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/name_resolution/if_expr_3/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Expr: <CallExpr test.adb:19:16-19:54>
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
Expr: <Id "Integer" test.adb:19:16-19:23>
references: <DefiningName "Integer" __standard:4:8-4:15>
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
type: None
expected type: None
Expr: <IfExpr test.adb:19:25-19:53>
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/name_resolution/operators_10/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Expr: <CallExpr test.adb:14:9-14:20>
expected type: <ConcreteTypeDecl ["F"] test.adb:4:4-4:23>
Expr: <Id "F" test.adb:14:9-14:10>
references: <DefiningName "F" test.adb:4:9-4:10>
type: <ConcreteTypeDecl ["F"] test.adb:4:4-4:23>
type: None
expected type: None
Expr: <BinOp test.adb:14:12-14:19>
type: <ConcreteTypeDecl ["root_real"] __standard:121:3-121:31>
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/name_resolution/operators_17/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Expr: <CallExpr test.adb:6:19-6:34>
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
Expr: <Id "Integer" test.adb:6:19-6:26>
references: <DefiningName "Integer" __standard:4:8-4:15>
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
type: None
expected type: None
Expr: <BinOp test.adb:6:28-6:33>
type: <ConcreteTypeDecl ["T"] test.adb:2:4-2:44>
Expand Down
4 changes: 2 additions & 2 deletions testsuite/tests/name_resolution/qualified_type_conv/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Expr: <CallExpr repro.adb:7:12-7:24>
expected type: None
Expr: <DottedName repro.adb:7:12-7:19>
references: <DefiningName "T" repro.adb:3:12-3:13>
type: <ConcreteTypeDecl ["T"] repro.adb:3:7-3:29>
type: None
expected type: None
Expr: <Id "Pouet" repro.adb:7:12-7:17>
references: <DefiningName "Pouet" repro.adb:2:12-2:17>
Expand Down Expand Up @@ -62,7 +62,7 @@ Expr: <CallExpr repro.adb:17:12-17:18>
expected type: None
Expr: <Id "T" repro.adb:17:12-17:13>
references: <DefiningName "T" repro.adb:3:12-3:13>
type: <ConcreteTypeDecl ["T"] repro.adb:3:7-3:29>
type: None
expected type: None
Expr: <Int repro.adb:17:15-17:17>
references: None
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/name_resolution/reduce_attr/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ Expr: <CallExpr acc.adb:20:24-20:39>
expected type: <ConcreteTypeDecl ["Real"] acc.adb:3:4-3:26>
Expr: <Id "Real" acc.adb:20:24-20:28>
references: <DefiningName "Real" acc.adb:3:9-3:13>
type: <ConcreteTypeDecl ["Real"] acc.adb:3:4-3:26>
type: None
expected type: None
Expr: <DottedName acc.adb:20:29-20:38>
references: <DefiningName "Count" acc.adb:8:7-8:12>
Expand Down
8 changes: 4 additions & 4 deletions testsuite/tests/name_resolution/string_concat/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Expr: <CallExpr test.adb:11:27-11:45>
expected type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57>
Expr: <Id "String" test.adb:11:27-11:33>
references: <DefiningName "String" __standard:105:8-105:14>
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57>
type: None
expected type: None
Expr: <ConcatOp test.adb:11:35-11:44>
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57>
Expand Down Expand Up @@ -237,7 +237,7 @@ Expr: <CallExpr test.adb:15:27-15:54>
expected type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57>
Expr: <Id "String" test.adb:15:27-15:33>
references: <DefiningName "String" __standard:105:8-105:14>
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57>
type: None
expected type: None
Expr: <ConcatOp test.adb:15:35-15:53>
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57>
Expand Down Expand Up @@ -316,7 +316,7 @@ Expr: <CallExpr test.adb:22:25-22:40>
expected type: <SubtypeDecl ["T"] test.adb:18:7-18:27>
Expr: <Id "T" test.adb:22:25-22:26>
references: <DefiningName "T" test.adb:18:15-18:16>
type: <SubtypeDecl ["T"] test.adb:18:7-18:27>
type: None
expected type: None
Expr: <ConcatOp test.adb:22:28-22:39>
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57>
Expand Down Expand Up @@ -361,7 +361,7 @@ Expr: <CallExpr test.adb:24:25-24:34>
expected type: <SubtypeDecl ["T"] test.adb:18:7-18:27>
Expr: <Id "T" test.adb:24:25-24:26>
references: <DefiningName "T" test.adb:18:15-18:16>
type: <SubtypeDecl ["T"] test.adb:18:7-18:27>
type: None
expected type: None
Expr: <ConcatOp test.adb:24:28-24:33>
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57>
Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/name_resolution/type_conv_deref/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Expr: <CallExpr test.adb:10:9-10:31>
expected type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
Expr: <Id "Integer" test.adb:10:9-10:16>
references: <DefiningName "Integer" __standard:4:8-4:15>
type: <ConcreteTypeDecl ["Integer"] __standard:4:3-4:54>
type: None
expected type: None
Expr: <ExplicitDeref test.adb:10:18-10:30>
references: <DefiningName "Foo" test.adb:5:13-5:16>
Expand Down
6 changes: 3 additions & 3 deletions testsuite/tests/name_resolution/type_predicates/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ Expr: <CallExpr derived.adb:5:31-5:58>
expected type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57>
Expr: <Id "String" derived.adb:5:31-5:37>
references: <DefiningName "String" __standard:105:8-105:14>
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57>
type: None
expected type: None
Expr: <CallExpr derived.adb:5:39-5:57>
references: <DefiningName "String_T" derived.adb:4:9-4:17>
Expand Down Expand Up @@ -306,7 +306,7 @@ Expr: <CallExpr derived.adb:13:23-13:51>
expected type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57>
Expr: <Id "String" derived.adb:13:23-13:29>
references: <DefiningName "String" __standard:105:8-105:14>
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57>
type: None
expected type: None
Expr: <CallExpr derived.adb:13:31-13:50>
references: <DefiningName "String_T2" derived.adb:12:9-12:18>
Expand Down Expand Up @@ -388,7 +388,7 @@ Expr: <CallExpr derived.adb:23:19-23:47>
expected type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57>
Expr: <Id "String" derived.adb:23:19-23:25>
references: <DefiningName "String" __standard:105:8-105:14>
type: <ConcreteTypeDecl ["String"] __standard:105:3-105:57>
type: None
expected type: None
Expr: <CallExpr derived.adb:23:27-23:46>
references: <DefiningName "String_T3" derived.adb:20:9-20:18>
Expand Down
4 changes: 2 additions & 2 deletions testsuite/tests/name_resolution/universal_fixed/test.out
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Expr: <CallExpr test.adb:17:12-17:24>
expected type: <ConcreteTypeDecl ["T1"] test.adb:4:6-4:55>
Expr: <Id "T1" test.adb:17:12-17:14>
references: <DefiningName "T1" test.adb:4:11-4:13>
type: <ConcreteTypeDecl ["T1"] test.adb:4:6-4:55>
type: None
expected type: None
Expr: <BinOp test.adb:17:16-17:23>
type: <ConcreteTypeDecl ["T1"] test.adb:4:6-4:55>
Expand Down Expand Up @@ -91,7 +91,7 @@ Expr: <CallExpr test.adb:20:12-20:24>
expected type: <ConcreteTypeDecl ["T1"] test.adb:4:6-4:55>
Expr: <Id "T1" test.adb:20:12-20:14>
references: <DefiningName "T1" test.adb:4:11-4:13>
type: <ConcreteTypeDecl ["T1"] test.adb:4:6-4:55>
type: None
expected type: None
Expr: <BinOp test.adb:20:16-20:23>
type: <ConcreteTypeDecl ["Universal_Fixed_Type_"] __standard:118:3-118:62>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Expr: <CallExpr type_conv.adb:6:9-6:18>
expected type: <ConcreteTypeDecl ["Pouet"] type_conv.adb:2:4-2:33>
Expr: <Id "Pouet" type_conv.adb:6:9-6:14>
references: <DefiningName "Pouet" type_conv.adb:2:9-2:14>
type: <ConcreteTypeDecl ["Pouet"] type_conv.adb:2:4-2:33>
type: None
expected type: None
Expr: <Id "Q" type_conv.adb:6:16-6:17>
references: <DefiningName "Q" type_conv.adb:4:4-4:5>
Expand Down
10 changes: 10 additions & 0 deletions testsuite/tests/properties/call_expr_kind/array_type.adb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
procedure Array_Type is
type Arr is array (1 .. 32) of Integer;
type Arr_2 is array (1 .. 32) of Integer;

X : Arr;
Y : Arr_2;
begin
X := Arr (Y);
--% node.f_expr.p_kind
end Array_Type;
6 changes: 6 additions & 0 deletions testsuite/tests/properties/call_expr_kind/test.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Working on node <AssignStmt array_type.adb:8:4-8:17>
====================================================

Eval 'node.f_expr.p_kind'
Result: 'type_conversion'

Working on node <RequeueStmt family_index.adb:12:10-12:24>
==========================================================

Expand Down
2 changes: 1 addition & 1 deletion testsuite/tests/properties/call_expr_kind/test.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
driver: inline-playground
input_sources: [kind.adb, family_index.adb]
input_sources: [kind.adb, family_index.adb, array_type.adb]

0 comments on commit 394a2ac

Please sign in to comment.