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);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
The text was updated successfully, but these errors were encountered:
Description
Continued from #12896 . Created the issue as requested in #13005 (comment)
In custom errors like the following :
The compiler mistakenly considers
MyInterface.MyCustomErrorto be of typefunction() pureinstead of typeerror. The latter is what should be used.Running
solc test.solfor the following codegives the following error
The text was updated successfully, but these errors were encountered: