-
-
Notifications
You must be signed in to change notification settings - Fork 608
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 20653 . Short circuit manifest constant evaluation #10939
Conversation
|
Please explain the point of this. Is it a bug fix? An enchancement? |
Dunno where the bot is though. |
Can you split them into a different commit? |
|
I started this as a draft PR, so maybe @dlang-bot didn't notice when I dropped the draft. I'll split into 2 commits. I'll also add a test with && |
|
Thanks for your pull request and interest in making D better, @benjones! 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 run digger -- build "master + dmd#10939" |
|
Could you add a test with a template instantiation ? T myFunc() { return T.init; }
enum Foo(T) = is(T == int) || myFunc!T();
void main ()
{
assert(myFunc!int() == 0);
}The idea is to check that |
I mean, cheeky bugger's probably self-isolating! |
I can't let you Aussies have a monopoly on cool phrases. It's not fair! |
|
😛 |
Could also add this to the |
| @@ -805,9 +806,11 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor | |||
| // so mark the scope as ctfe if required | |||
| bool needctfe = (dsym.storage_class & (STC.manifest | STC.static_)) != 0; | |||
| if (needctfe) | |||
| { | |||
| sc.flags |= SCOPE.condition; | |||
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.
@benjones This breaks the error for is Identifier forms used outside of static if/assert:
https://issues.dlang.org/show_bug.cgi?id=23827
I tried making a fix but it doesn't pass the test suite.
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 saw your new PR. It's been so long, I don't remember how I came to think this was the right fix and probably won't have time to look closely in the next couple of weeks.
The fix is adding the SCOPE.condition flag when doing CTFE to infer the VarDecl type in dsymbolsem.
The rest of the changes are fixes to the debug logging. I can remove them if they're distracting