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

When interposing on constructors super constructor invocations get put on the wrong function. #100

Closed
cd1m0 opened this issue Oct 28, 2021 · 0 comments · Fixed by #102 or #112
Closed
Assignees
Labels
bug Something isn't working

Comments

@cd1m0
Copy link
Collaborator

cd1m0 commented Oct 28, 2021

Given the following code:

contract Base {
    constructor(uint x) public {}
}

/// #if_succeeds true;
contract Child is Base {
    constructor() Base(1) {
    }
}

When we instrument the Base(1) super-constructor invocation gets mistakenly placed on the inner _original_Child_constructor function, instead of the constructor:

/// #if_succeeds true;
contract Child is Base {
    event AssertionFailed(string message);

    constructor() {
        _original_Child_constructor();
        unchecked {
            if (!(true)) {
                emit AssertionFailed("0: ");
                assert(false);
            }
        }
    }

    function _original_Child_constructor() Base(1)  private {}
}

Thus the resulting code doesn't compile. It should be placed on the constructor.

@cd1m0 cd1m0 self-assigned this Oct 28, 2021
cd1m0 added a commit that referenced this issue Oct 28, 2021
@blitz-1306 blitz-1306 linked a pull request Oct 28, 2021 that will close this issue
cd1m0 added a commit that referenced this issue Oct 29, 2021
@cd1m0 cd1m0 added the bug Something isn't working label Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant