ballerina-spec
ballerina-spec copied to clipboard
Ambiguity in `async-send-action` and `check-expr` parsing
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);
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.