Add -preview=shortenedMethods to language spec#2956
Conversation
|
Thanks for your pull request and interest in making D better, @pbackus! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
|
Thank you for taking action! |
| $(GLINK FunctionContracts)$(OPT) $(GLINK InOutStatement) | ||
|
|
||
| $(GNAME ShortenedFunctionBody): | ||
| $(D =>) $(GLINK AssignExpression) $(D ;) |
There was a problem hiding this comment.
The parser accepts the fully Expression rather than AssignExpression, so one of them is wrong/(needs changing).
This could also use an example as well (just a cleaned up testcase would be fine)
There was a problem hiding this comment.
Added an example.
Re: Expression vs AssignExpression, AssignExpression is what's used in the grammar for lambdas, which this is supposed to match. And the only other thing included in Expression is CommaExpression, which would be rejected by semantic analysis anyway. So I think it's the parser that's wrong here.
|
@pbackus Currently https://github.com/dlang/dmd/blob/master/test/compilable/shortened_methods.d#L9 doesn't parse with the official grammar, would you be willing to have another look at this? |
See dlang/dmd#11833.