Skip to content

Function overflow clash #16

Description

@Amxx

Reproducible example

In Test.sol:Foo

    //...
    struct Z {
        bool z;
    }

    struct Z2 {
        bool z;
    }

    function _testClash(S storage t) internal {}
    function _testClash(Z storage t) internal {}
    function _testClash(Z2 storage t) internal {}
    function _testClash(S memory t) internal {}
    function _testClash(Z memory t) internal {}
    function _testClash(Z2 memory t) internal {}
}

causes

TypeError: Function overload clash during conversion to external types for arguments.
  --> contracts-exposed/Test.sol:54:5:
   |
54 |     function $_testClash(Foo.Z2 calldata t) external {
   |     ^ (Relevant source part starts here and spans across multiple lines).

This is because the internal function use different types, but Z and Z2 have the same underlying type, cause the external version to have function selector clash.

Possible fix:

When constructing the clashingFunctions record, consider the resulting function selector, and not the internal type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions