New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Issue 19869 - FunctionLiteral
allows incorrect forms
#3350
Conversation
SpecifiedFunctionBody allows `do` and contracts. https://dlang.org/spec/function.html#SpecifiedFunctionBody
Thanks for your pull request and interest in making D better, @ntrel! 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 references
|
FunctionLiteral
allows incorrect formsFunctionLiteral
allows incorrect forms
@@ -1854,7 +1854,7 @@ $(GNAME FunctionLiteral): | |||
$(D function) $(D ref)$(OPT) $(GLINK2 type, Type)$(OPT) $(GLINK ParameterWithAttributes)$(OPT) $(GLINK FunctionLiteralBody2) | |||
$(D delegate) $(D ref)$(OPT) $(GLINK2 type, Type)$(OPT) $(GLINK ParameterWithMemberAttributes)$(OPT) $(GLINK FunctionLiteralBody2) | |||
$(D ref)$(OPT) $(GLINK ParameterWithMemberAttributes) $(GLINK FunctionLiteralBody2) | |||
$(GLINK2 function, SpecifiedFunctionBody) | |||
$(GLINK2 statement, BlockStatement) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one looks right
spec/expression.dd
Outdated
@@ -1865,14 +1865,14 @@ $(GNAME ParameterWithMemberAttributes): | |||
|
|||
$(GNAME FunctionLiteralBody2): | |||
$(D =>) $(GLINK AssignExpression) | |||
$(GLINK2 function, SpecifiedFunctionBody) | |||
$(GLINK2 statement, BlockStatement) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this one doesn't look right, this is allowed:
auto b = function int(int x) do {return true;};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, restored this line.
SpecifiedFunctionBody allows
do
and contracts.https://dlang.org/spec/function.html#SpecifiedFunctionBody