Skip to content
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

Merged
merged 2 commits into from Jul 27, 2022

Conversation

ntrel
Copy link
Contributor

@ntrel ntrel commented Jul 23, 2022

SpecifiedFunctionBody allows do and contracts.
https://dlang.org/spec/function.html#SpecifiedFunctionBody

@dlang-bot
Copy link
Contributor

dlang-bot commented Jul 23, 2022

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 verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

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

Auto-close Bugzilla Severity Description
19869 normal `FunctionLiteral` allows incorrect forms

@ntrel ntrel changed the title [spec] Fix Issue 19869 - FunctionLiteral allows incorrect forms Fix Issue 19869 - FunctionLiteral allows incorrect forms Jul 24, 2022
@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one looks right

@@ -1865,14 +1865,14 @@ $(GNAME ParameterWithMemberAttributes):

$(GNAME FunctionLiteralBody2):
$(D =>) $(GLINK AssignExpression)
$(GLINK2 function, SpecifiedFunctionBody)
$(GLINK2 statement, BlockStatement)
Copy link
Contributor

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;};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, restored this line.

@RazvanN7 RazvanN7 merged commit 25edf7b into dlang:master Jul 27, 2022
@ntrel ntrel deleted the fn-lit-forms branch July 27, 2022 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants