ballerina-spec icon indicating copy to clipboard operation
ballerina-spec copied to clipboard

Ambiguity in `async-send-action` and `check-expr` parsing

Open prakanth97 opened this issue 1 year ago • 1 comments

Description: As per the spec https://ballerina.io/spec/lang/master/#expressions, we seems to have no entry for the sync-send-action and async-send-action.

In the current implementation,

() a = check 5 -> w1;

async-send-action gets high precedence. But,

() a = check 5 ->> w2;

sync-send-action gets low precedence. What should be the correct grouping ? () a = (check 5) -> w1; or () a = check (5 -> w1);

prakanth97 avatar Jun 19 '23 11:06 prakanth97

Here https://ballerina.io/spec/lang/master/#section_7.1 we say

The precedence for action-or-expr is the same as for expression, with the addition that the -> operator used in a client-remote-method-call-action has the same precedence as the . operator used in a method-call-expr.

We need to add something to this to handle -> and ->> used in (async-)send-action

I expect the reason why jBallerina handles them differently is that async-send-action doesn't return anything else (and indeed it used to be a statement).

I need to think about what the right answer is here.

jclark avatar Jun 19 '23 12:06 jclark