diff --git a/ada/ast.py b/ada/ast.py index a66343a62..a41df54cb 100644 --- a/ada/ast.py +++ b/ada/ast.py @@ -21963,7 +21963,19 @@ def xref_equation(): return And( # We call xref_no_overloading to make sure that sub-names are # bound. - name.xref_no_overloading, + name.match( + # If name is a DottedName, prefix can be a CallExpr that should + # be resolved using sub_equation. + lambda dn=T.DottedName: + If(dn.prefix.is_a(CallExpr), + dn.prefix.sub_equation, + dn.prefix.xref_no_overloading) + & env.bind( + dn.prefix.designated_env, + dn.suffix.xref_no_overloading + ), + lambda o: o.xref_no_overloading + ), # Then, bind the name to any entry that fits the bills entries.logic_any(lambda e: Let( diff --git a/testsuite/tests/name_resolution/requeue_stmt_3/test.adb b/testsuite/tests/name_resolution/requeue_stmt_3/test.adb new file mode 100644 index 000000000..32bc82cca --- /dev/null +++ b/testsuite/tests/name_resolution/requeue_stmt_3/test.adb @@ -0,0 +1,39 @@ +procedure Test is + protected type PT is + entry Process; + end PT; + + protected body PT is + entry Process when True is + begin + null; + end Process; + end PT; + + type My_Range is range 1 .. 2; + type My_Array is array (My_Range) of PT; + Arr : My_Array; + + function F (I, J : Float) return My_Range is + begin + return My_Range (I * J); + end F; + + task T is + entry P (Name : String); + end T; + + task body T is + Index : My_Range := 1; + begin + accept P (Name : String) do + requeue Arr (Index).Process; + pragma Test_Statement; + + requeue Arr (F (4.3, 8.9)).Process; + pragma Test_Statement; + end P; + end T; +begin + null; +end Test; diff --git a/testsuite/tests/name_resolution/requeue_stmt_3/test.out b/testsuite/tests/name_resolution/requeue_stmt_3/test.out new file mode 100644 index 000000000..e7b2bcb71 --- /dev/null +++ b/testsuite/tests/name_resolution/requeue_stmt_3/test.out @@ -0,0 +1,65 @@ +Analyzing test.adb +################## + +Resolving xrefs for node +*********************************************************** + +Expr: + references: + type: None + expected type: None +Expr: + references: + type: + expected type: None +Expr: + references: + type: + expected type: None +Expr: + references: + type: + expected type: +Expr: + references: + type: None + expected type: None + +Resolving xrefs for node +*********************************************************** + +Expr: + references: + type: None + expected type: None +Expr: + references: + type: + expected type: None +Expr: + references: + type: + expected type: None +Expr: + references: + type: + expected type: +Expr: + references: + type: + expected type: None +Expr: + references: None + type: + expected type: +Expr: + references: None + type: + expected type: +Expr: + references: + type: None + expected type: None + + +Done. diff --git a/testsuite/tests/name_resolution/requeue_stmt_3/test.yaml b/testsuite/tests/name_resolution/requeue_stmt_3/test.yaml new file mode 100644 index 000000000..173e325ff --- /dev/null +++ b/testsuite/tests/name_resolution/requeue_stmt_3/test.yaml @@ -0,0 +1,2 @@ +driver: name-resolution +input_sources: [test.adb]