Skip to content

Commit 25fa0d4

Browse files
Merge pull request #13022 from ethereum/ice_in_abi_encodecall_when_internal_function_passed_in_arg_of_different_type
Add tests for `abi.encodeCall()` ICE on internal function passed in arg of different type
2 parents 55df07f + 7ff4cab commit 25fa0d4

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
contract C {
2+
function f(uint) external {}
3+
4+
function main() external view {
5+
function () h;
6+
abi.encodeCall(this.f, (h));
7+
}
8+
}
9+
// ----
10+
// TypeError 5407: (137-140): Cannot implicitly convert component at position 0 from "function ()" to "uint256".
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
struct S {
2+
function () f;
3+
}
4+
5+
contract C {
6+
enum testEnum { choice1, choice2, choice3 }
7+
8+
function f1(uint8) external {}
9+
function f2(uint32) external {}
10+
function f3(uint) external {}
11+
function g1(bytes memory) external {}
12+
function g2(bytes32) external {}
13+
function h(string memory) external {}
14+
function i(bool) external {}
15+
function j(address) external {}
16+
function k(address payable) external {}
17+
function l(testEnum) external {}
18+
19+
function main() external view {
20+
S memory s;
21+
abi.encodeCall(this.f1, (s));
22+
abi.encodeCall(this.f2, (s));
23+
abi.encodeCall(this.f3, (s));
24+
abi.encodeCall(this.g1, (s));
25+
abi.encodeCall(this.g2, (s));
26+
abi.encodeCall(this.h, (s));
27+
abi.encodeCall(this.i, (s));
28+
abi.encodeCall(this.j, (s));
29+
abi.encodeCall(this.k, (s));
30+
abi.encodeCall(this.l, (s));
31+
}
32+
}
33+
// ----
34+
// TypeError 5407: (560-563): Cannot implicitly convert component at position 0 from "struct S memory" to "uint8".
35+
// TypeError 5407: (598-601): Cannot implicitly convert component at position 0 from "struct S memory" to "uint32".
36+
// TypeError 5407: (636-639): Cannot implicitly convert component at position 0 from "struct S memory" to "uint256".
37+
// TypeError 5407: (674-677): Cannot implicitly convert component at position 0 from "struct S memory" to "bytes memory".
38+
// TypeError 5407: (712-715): Cannot implicitly convert component at position 0 from "struct S memory" to "bytes32".
39+
// TypeError 5407: (749-752): Cannot implicitly convert component at position 0 from "struct S memory" to "string memory".
40+
// TypeError 5407: (786-789): Cannot implicitly convert component at position 0 from "struct S memory" to "bool".
41+
// TypeError 5407: (823-826): Cannot implicitly convert component at position 0 from "struct S memory" to "address".
42+
// TypeError 5407: (860-863): Cannot implicitly convert component at position 0 from "struct S memory" to "address payable".
43+
// TypeError 5407: (897-900): Cannot implicitly convert component at position 0 from "struct S memory" to "enum C.testEnum".

0 commit comments

Comments
 (0)