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 6400 - Better interaction between with() and opDispatch #6439
Conversation
|
ss = sc2.scopesym.isWithScopeSymbol(); | ||
} | ||
|
||
if (ss && ss.withstate.wthis) |
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 logic could be simplified by moving it inside the loop above.
@WalterBright What about nested with (foo)
{
with (bar)
{
baz();
}
} |
I'd say the innermost scope wins. |
Looks good. Please add a test case with the nested |
I've touched up the test-case a bit, I hope it's not too convoluted. |
} | ||
with (baz) | ||
{ | ||
static assert(!__traits(compiles, f2())); |
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 have expected calling f2
to print foo
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.
@andralex @WalterBright what's your take on this? It's very unusual that outer symbols are not visible in inner scopes (even if the symbol is rewritten to opDispatch
).
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.
Yes, looks like one more step closer to C++'s "nobody knows what this language construct will actually do".
No description provided.