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 20362 - always infer scope for lambdas #10764
Conversation
Before, scope was only inferred if -preview=dip1000 was used, now it always is.
Thanks for your pull request and interest in making D better, @atilaneves! 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
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + dmd#10764" |
// See https://issues.dlang.org/show_bug.cgi?id=20362 | ||
const isLambda = funcdecl.isFuncLiteralDeclaration; | ||
|
||
if ((funcdecl.flags & FUNCFLAG.inferScope || isLambda) && !(fparam.storageClass & STC.scope_)) |
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.
Why not set inferScope
unconditionally for FuncLiteralDeclaration
instead of special casing things here ?
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.
Because it broke a lot of things, including dmd's own tests.
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.
What I had in mind was: #10770
Don't see any failure with that.
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.
Ah, ok. That's not what I did originally, but even though it was yesterday I can't quite remember what that was exactly.
This pull request introduced a regression: https://issues.dlang.org/show_bug.cgi?id=21285 |
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.
I would not have merged this.
|
||
// infer scope for lambdas even without -preview=dip1000 | ||
// See https://issues.dlang.org/show_bug.cgi?id=20362 | ||
const isLambda = funcdecl.isFuncLiteralDeclaration; |
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.
parens.
Before, scope was only inferred if -preview=dip1000 was used, now it always is.