|
| 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