Skip to content

Typechecker: functions #9

@bitbart

Description

@bitbart

Extend the typechecker so that it detects as many errors as possible related to function calls. A non-exaustive list of contracts that should not pass typechecking is provided below.

contract C {
    int x;
    function f() public view returns (uint) { return(x>0); }
}

The function f is declared to return an uint but it returns a bool.

contract C {
    int x;
    function f(int y) public { x = y; }
    function g() public { this.f(); }
}

The function f is declared to take as input an integer, but the function g calls is passing no parameters.

contract C {
    uint x;
    function f() public pure returns(int) { return(1); }
    function g() public { bool b; b = this.f(); }
}

The function f is declared to resutn an int, but its caller g expects a bool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions