You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like the language spec grammar snippets have not yet been adjusted to reflect this change i.e. the selector grammar snippet does not contain a typeArguments production.
So it looks like, according to this comment by Erik, that this is resolved in favor of the second parse tree because the typeArguments arguments production comes first and that the language specification does not attempt to present a grammar that is deterministic wrt to the parse tree that it describes.
I think I've found a grammar that doesn't have this ambiguity. @eernst if you agree, can we make this change to the ANTLR-based grammar spec (and eventually the language spec)?
The idea is that a selector can only appear as a selector*, so any alternative of selector will be able to follow any other alternative of selector. The third production (argumentPart) of selector can therefore be replaced with arguments because there's already a typeArguments production in selector i.e. I think we can change:
A recent change made it possible to give function invocations type arguments without having to invoke the function with value arguments.
It looks like this change has lead to a new production
typeArguments
in the selector production rule in the ANTLR-based grammar spec.https://github.com/dart-lang/sdk/blob/b06b994a4eea9eb88ef5b40060bd8ff16b848868/tools/spec_parser/Dart.g#L971-L982
It looks like the language spec grammar snippets have not yet been adjusted to reflect this change i.e. the
selector
grammar snippet does not contain atypeArguments
production.language/specification/dartLangSpec.tex
Lines 16270 to 16277 in a620967
If we were to add a
typeArguments
production to theselector
production rule, then I think this would giveid<int>()
2 parse trees:I'm wondering what a grammar that does not have this ambiguity would look like?
The text was updated successfully, but these errors were encountered: