mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix type check for nested arrays in abi.encode/decode functions in ABIEncoderV1
- Without this fix, nested arrays are not detected as unsupported and compiler fails on an UnimplementedError. - Now it's consistent with how structs are handled in ABIEncoderV1.
This commit is contained in:
+7
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
abi.encodePacked([new uint[](5), new uint[](7)]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9578: (69-99): Type not supported in packed mode.
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
abi.encodePacked([new uint[](5), new uint[](7)]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9578: (104-134): Type not supported in packed mode.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function test() public pure {
|
||||
abi.encode([new uint[](5), new uint[](7)]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 2056: (66-96): This type cannot be encoded.
|
||||
@@ -0,0 +1,9 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
abi.encode([new uint[](5), new uint[](7)]);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6133: (87-129): Statement has no effect.
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
abi.decode("1234", (uint[][3]));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9611: (72-81): Decoding type uint256[] memory[3] memory not supported.
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
abi.decode("1234", (uint[][3]));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6133: (87-118): Statement has no effect.
|
||||
@@ -0,0 +1,11 @@
|
||||
struct S {
|
||||
uint x;
|
||||
}
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
abi.decode("1234", (S));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9611: (98-99): Decoding type struct S memory not supported.
|
||||
@@ -0,0 +1,13 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
struct S {
|
||||
uint x;
|
||||
}
|
||||
|
||||
contract C {
|
||||
function f() public pure {
|
||||
abi.decode("1234", (S));
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6133: (113-136): Statement has no effect.
|
||||
Reference in New Issue
Block a user