diff --git a/ada/ast.py b/ada/ast.py index d0be091b5..ea0520acc 100644 --- a/ada/ast.py +++ b/ada/ast.py @@ -15453,7 +15453,7 @@ def record_assoc_equation(): match.formal.formal_decl.type_expression.designated_type ), match.actual.assoc.expr.sub_equation, - match.actual.assoc.expr.matches_expected_type, + match.actual.assoc.expr.matches_expected_assign_type, match.actual.name.then( lambda n: Bind(n.ref_var, match.formal.formal_decl), LogicTrue() diff --git a/testsuite/tests/name_resolution/anonymous_type_match/test.adb b/testsuite/tests/name_resolution/anonymous_type_match/test.adb new file mode 100644 index 000000000..3f05220fc --- /dev/null +++ b/testsuite/tests/name_resolution/anonymous_type_match/test.adb @@ -0,0 +1,23 @@ +procedure Test is + type Obj is tagged null record; + + type T is record + Class : access Obj'Class; + end record; + + type Obj2 is new Obj with record + I : Integer; + end record; + + procedure P (Prm : access Obj2); + + procedure P (Prm : access Obj2) is + E : T := T'(Class => Prm); + pragma Test_Statement; + begin + null; + end P; + +begin + null; +end Test; diff --git a/testsuite/tests/name_resolution/anonymous_type_match/test.out b/testsuite/tests/name_resolution/anonymous_type_match/test.out new file mode 100644 index 000000000..db5bc5bce --- /dev/null +++ b/testsuite/tests/name_resolution/anonymous_type_match/test.out @@ -0,0 +1,32 @@ +Analyzing test.adb +################## + +Resolving xrefs for node +*************************************************************** + +Expr: + references: + type: None + expected type: None +Expr: + references: + type: + expected type: +Expr: + references: + type: None + expected type: None +Expr: + type: + expected type: +Expr: + references: + type: None + expected type: None +Expr: + references: + type: + expected type: + + +Done. diff --git a/testsuite/tests/name_resolution/anonymous_type_match/test.yaml b/testsuite/tests/name_resolution/anonymous_type_match/test.yaml new file mode 100644 index 000000000..173e325ff --- /dev/null +++ b/testsuite/tests/name_resolution/anonymous_type_match/test.yaml @@ -0,0 +1,2 @@ +driver: name-resolution +input_sources: [test.adb]