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

Issue 11042 - Inconsistent "static condition" behaviors #2558

Merged
merged 1 commit into from
Sep 3, 2014

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Sep 15, 2013

http://d.puremagic.com/issues/show_bug.cgi?id=11042

Divide SCOPEcondition and SCOPEconstraint properly.

@WalterBright
Copy link
Member

I'm not sure this is a correct design. Consider:

static if           (is(typeof(true  || error)) == false) {} else { static assert(0); } 

The 'static if' characteristic applies to the expression inside the typeof(). But should it? I think the lazy evaluation of && and || should only apply at the top level.

@9rnsr
Copy link
Contributor Author

9rnsr commented Sep 19, 2013

The main point of issue 11042 is: The 'static if' characteristic should not affect inside typeof() and __traits(compiles).

static if (is(typeof(true || error)) == false) {} else { static assert(0); }

Even in static condition, typeof(true || error) makes error, then is(typeof(true || error)) evaluated to false.

I think the lazy evaluation of && and || should only apply at the top level.

That's what this PR is implementing.

@@ -125,7 +125,7 @@ void *Scope::operator new(size_t size)
this->intypeof = enclosing->intypeof;
this->speculative = enclosing->speculative;
this->callSuper = enclosing->callSuper;
this->flags = (enclosing->flags & (SCOPEcontract | SCOPEdebug | SCOPEctfe));
this->flags = (enclosing->flags & (SCOPEcontract | SCOPEdebug | SCOPEctfe | SCOPEconstraint));
Copy link
Member

Choose a reason for hiding this comment

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

Sure about this? How can you get a nested scope with a template constraint?

@MartinNowak
Copy link
Member

LGTM

@9rnsr
Copy link
Contributor Author

9rnsr commented Aug 21, 2014

Why this PR is left for one year?

@9rnsr 9rnsr force-pushed the fix11042 branch 3 times, most recently from 3807e32 to 98519c0 Compare August 28, 2014 16:39
Divide `SCOPEcondition` and `SCOPEconstraint` properly.
@MartinNowak
Copy link
Member

Auto-merge toggled on

@MartinNowak
Copy link
Member

Github's makes it difficult to keep track of open pull requests, because it's notification driven.
It's always adequate to post a followup comment (e.g. ping), if something slips under the radar.

@IgorStepanov
Copy link
Contributor

Github's makes it difficult to keep track of open pull requests, because it's notification driven.
It's always adequate to post a followup comment (e.g. ping), if something slips under the radar.

ping dlang/druntime#934 :)

MartinNowak added a commit that referenced this pull request Sep 3, 2014
Issue 11042 - Inconsistent "static condition" behaviors
@MartinNowak MartinNowak merged commit a24ed80 into dlang:master Sep 3, 2014
@9rnsr 9rnsr deleted the fix11042 branch September 3, 2014 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants