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 20362 - always infer scope for lambdas #10764

Merged
merged 1 commit into from Feb 6, 2020

Conversation

atilaneves
Copy link
Contributor

Before, scope was only inferred if -preview=dip1000 was used, now it always is.

Before, scope was only inferred if -preview=dip1000
was used, now it always is.
@dlang-bot
Copy link
Contributor

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 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
20362 normal dmd fails to infer scope parameter for delegate

Testing this PR locally

If 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"

@dlang-bot dlang-bot merged commit bb1981f into dlang:master Feb 6, 2020
// See https://issues.dlang.org/show_bug.cgi?id=20362
const isLambda = funcdecl.isFuncLiteralDeclaration;

if ((funcdecl.flags & FUNCFLAG.inferScope || isLambda) && !(fparam.storageClass & STC.scope_))
Copy link
Member

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 ?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

@Geod24
Copy link
Member

Geod24 commented Dec 28, 2020

This pull request introduced a regression: https://issues.dlang.org/show_bug.cgi?id=21285

Copy link
Member

@UplinkCoder UplinkCoder left a 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;
Copy link
Member

Choose a reason for hiding this comment

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

parens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants