Sitelet https://web.archive.org/web/20220608091730/https://github.com/ethereum/solidity/issues/13106
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

Custom error is described as "function() pure" instead of "error" in error messages in case of implicit conversions #13106

Open
nishant-sachdeva opened this issue Jun 8, 2022 · 0 comments
Labels
Projects

Comments

@nishant-sachdeva
Copy link
Contributor

@nishant-sachdeva nishant-sachdeva commented Jun 8, 2022 •

Description

Continued from #12896 . Created the issue as requested in #13005 (comment)

In custom errors like the following :

interface MyInterface {
    error MyCustomError();
}

The compiler mistakenly considers MyInterface.MyCustomError to be of type function() pure instead of type error. The latter is what should be used.

Running solc test.sol for the following code

interface MyInterface {
    error MyCustomError(uint256, bool);
}

contract Test {
    function test() public returns(bytes4) {
        return (MyInterface.MyCustomError);
    }
}

gives the following error

Error: Return argument type function (uint256,bool) pure is not implicitly convertible to expected type (type of first return variable) bytes4.
 --> test.sol:7:16:
  |
7 |         return (MyInterface.MyCustomError);
  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Solidity
  
New issues
Development

No branches or pull requests

1 participant