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 18688 - Constructors shouldn't have implicit super call if it throws #8100

Merged
merged 1 commit into from Mar 31, 2018

Conversation

RazvanN7
Copy link
Contributor

The problem with this is that if an assert(false); is encountered the scope of the function in which the assert is located is marked as halt no matter where the assert is located. Let's take for example the bug report:

class A {
    this(int x){}
    @disable this();
}
class B: A {
    this(int x) {
        super(x);
    }
    this(string b) {
        switch(b) {
            case "a":break;
            default: assert(false);
        }
        this(1);
    }
}

When this(1) is semantically analyzed, the scope is not updated to reflect that a constructor call is issued because it is considered that the line is not reachable, due to the assert(false). This is obviously wrong since the code is reachable in some situations. The fix makes it so that the scope is updated to reflect that a this/super call is issued even if inside a halt scope.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @RazvanN7! 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 annotated coverage diff directly on GitHub with CodeCov's browser extension
  • 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
18688 enhancement Constructors shouldn't have implicit super call if it throws

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#8100"

@@ -0,0 +1,43 @@
class A
Copy link
Member

Choose a reason for hiding this comment

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

Please add:

// https://issues.dlang.org/show_bug.cgi?id=18688

}
}

void main() {}
Copy link
Member

Choose a reason for hiding this comment

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

Not needed for compile-only tests

@RazvanN7
Copy link
Contributor Author

@WalterBright Done. Thank you!

@RazvanN7
Copy link
Contributor Author

RazvanN7 commented Mar 30, 2018

jenkins is failing, but when inspecting the problem looks like all the tests pass. I find the matter puzzling...

Later edit: I restarted the tests, hope this will solve the case

@wilzbach
Copy link
Member

If you look at the log (button at the top right), you can see:

[vibe-d/vibe.d+vibe-core-examples] Cannot contact runner-02-gce: hudson.remoting.RequestAbortedException: java.nio.channels.ClosedChannelException
[vibe-d/vibe.d+vibe-core-examples] Could not connect to runner-02-gce to send interrupt signal to process
Cancelling nested steps due to timeout
[Pipeline] [vibe-d/vibe.d+vibe-core-examples] }
[Pipeline] [vibe-d/vibe.d+vibe-core-examples] // dir
[Pipeline] [vibe-d/vibe.d+vibe-core-examples] sh
[vibe-d/vibe.d+vibe-core-examples] ERROR: Issue with creating launcher for agent runner-02-gce. The agent has not been fully initialized yet
[vibe-d/vibe.d+vibe-core-examples] ERROR: Issue with creating launcher for agent runner-02-gce. The agent has not been fully initialized yet
[vibe-d/vibe.d+vibe-core-examples] [Pipeline] [vibe-d/vibe.d+vibe-core-examples] }
[Pipeline] [vibe-d/vibe.d+vibe-core-examples] // withEnv
[Pipeline] [vibe-d/vibe.d+vibe-core-examples] }
[Pipeline] [vibe-d/vibe.d+vibe-core-examples] // ws
[Pipeline] [vibe-d/vibe.d+vibe-core-examples] }
[Pipeline] [vibe-d/vibe.d+vibe-core-examples] // node
[Pipeline] [vibe-d/vibe.d+vibe-core-examples] echo
[vibe-d/vibe.d+vibe-core-examples] java.io.IOException: remote file operation failed: /var/lib/jenkins/dlang_projects@6 at hudson.remoting.Channel@ce5d808:JNLP4-connect connection from 133.132.198.35.bc.googleusercontent.com/35.198.132.133:53510: hudson.remoting.ChannelClosedException: Remote call on JNLP4-connect connection from 133.132.198.35.bc.googleusercontent.com/35.198.132.133:53510 failed. The channel is closing down or has closed down
[Pipeline] [vibe-d/vibe.d+vibe-core-examples] node
[vibe-d/vibe.d+vibe-core-examples] Still waiting to schedule task
[vibe-d/vibe.d+vibe-core-examples] Waiting for next available executor
Body did not finish within grace period; terminating with extreme prejudice

It's some variation of:

In short: it's due to dlang/ci using cheap preemptible GCE instances which can get terminated while the build runs.
I restarted Jenkins for you.

@wilzbach
Copy link
Member

Windows failure is unrelated -> braddr/d-tester#71

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