-
-
Notifications
You must be signed in to change notification settings - Fork 606
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 14162 - Erratic inference of @safe for lambdas #5881
Conversation
@@ -1276,7 +1261,8 @@ extern (C++) class FuncDeclaration : Declaration | |||
*/ | |||
TemplateInstance ti; | |||
if (fbody && | |||
(isFuncLiteralDeclaration() || (storage_class & STCinference) || (inferRetType && !isCtorDeclaration()) || isInstantiated() && !isVirtualMethod() && | |||
(sc.func || isFuncLiteralDeclaration() || (storage_class & STCinference) || (inferRetType && !isCtorDeclaration()) || |
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.
Added sc.func here, because nested functions with bodies should have their attributes inferred unless overridden.
b324d31
to
b4e0260
Compare
Probably the most over-tested feature ever. |
0dcdd65
to
7e7d4c3
Compare
Blocked by dlang/phobos#4461 and dlang/phobos#4464 |
Auto-merge toggled on |
Blocked by dlang/phobos#4474 |
On Windows the tests fail for a different reason, btw: https://auto-tester.puremagic.com/show-run.ghtml?projectid=1&runid=2097110&isPull=true |
Blocked by dlang/phobos#4477 |
Blocked by dlang/phobos#4479 |
Blocked by dlang/phobos#4483 |
Blocked by dlang/phobos#4485 |
This introduced a regression. |
Inference of safety for lambdas should always occur if not explicitly set, because the source is always available.