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

Inheritance of specs in overloaded functions #155

Open
hajduakos opened this issue Sep 13, 2020 · 3 comments
Open

Inheritance of specs in overloaded functions #155

hajduakos opened this issue Sep 13, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@hajduakos
Copy link
Member

basic/ExplicitScopings.sol gives

======= Converting to Boogie IVL =======

======= test/solc-verify/basic/ExplicitScopings.sol =======
Annotation:1:10: solc-verify error: Undeclared identifier.
x + 1 == y 
         ^

where y is the return value of the annotated function

@hajduakos hajduakos added the bug Something isn't working label Sep 13, 2020
@dddejan
Copy link
Member

dddejan commented Oct 2, 2020

contract A {
    /** @notice postcondition x + 1 == y */
    function g(int x) public pure virtual returns (int y) {
        return A.f(x); // Explicit scoping with current contract name
    }
}

contract B is A {
    function g(int x) public pure override returns (int) {
        int z = A.g(x); // Explicit scoping with base name
        assert(z == x + 1);
        return z;
    }
}

This is happening because B::g overrides A::g and seems to inherits the tags (and hence the spec) of A::g.

@dddejan
Copy link
Member

dddejan commented Oct 2, 2020

Bug that might be related ethereum#9947

dddejan pushed a commit that referenced this issue Oct 22, 2020
related to #155, but that is a separate inheritence issue
@dddejan
Copy link
Member

dddejan commented Oct 22, 2020

I've fixed the test case, but the issue of inheriting the specs is very complicated and needs to be discussed.

@dddejan dddejan changed the title [0.7] Return value not visible in function annotation Inheritance of specs in overloaded functions Oct 22, 2020
@dddejan dddejan added enhancement New feature or request and removed bug Something isn't working labels Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants