Error messages from abi encodecall are giving more details about the types of the involved variables

This commit is contained in:
nishant-sachdeva
2022-03-11 16:14:55 +05:30
parent 4263b893a3
commit 624d2d3968
6 changed files with 52 additions and 3 deletions
@@ -0,0 +1,11 @@
interface I {
function f(address payable) external;
}
contract C {
function main() external view {
abi.encodeCall(I.f, (address(0)));
}
}
// ----
// TypeError 5407: (136-148): Cannot implicitly convert component at position 0 from "address" to "address payable".
@@ -0,0 +1,13 @@
interface I {
function f(function (string calldata) external) external;
}
contract C {
function g(string calldata) external {}
function main() external view {
abi.encodeCall(I.f, (this.g));
}
}
// ----
// TypeError 5407: (201-209): Cannot implicitly convert component at position 0 from "function (string memory) external" to "function (string calldata) external".
@@ -0,0 +1,13 @@
interface I {
function f(function (string calldata) external view returns (uint)) external;
}
contract C {
function g(string memory) external {}
function main() external view {
abi.encodeCall(I.f, (this.g));
}
}
// ----
// TypeError 5407: (219-227): Cannot implicitly convert component at position 0 from "function (string memory) external" to "function (string calldata) view external returns (uint256)".
@@ -0,0 +1,12 @@
interface I {
function f(string calldata) external;
}
contract C {
string s;
function main() external view {
abi.encodeCall(I.f, (s));
}
}
// ----
// TypeError 5407: (150-153): Cannot implicitly convert component at position 0 from "string storage ref" to "string calldata".