aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-08-14 22:32:57 +0800
committerGitHub <noreply@github.com>2018-08-14 22:32:57 +0800
commitec7ccbdf866c108e96e3e9adeab60c3b00195f91 (patch)
tree662734c7fa23295a50487acf1e032d7996e4d32b /test/libsolidity
parent029e217ed24c2d7584d9bbebb18920a77713afc6 (diff)
parent499ec8b024dbfb13e5a0635fbe5af68339057494 (diff)
downloaddexon-solidity-ec7ccbdf866c108e96e3e9adeab60c3b00195f91.tar.gz
dexon-solidity-ec7ccbdf866c108e96e3e9adeab60c3b00195f91.tar.zst
dexon-solidity-ec7ccbdf866c108e96e3e9adeab60c3b00195f91.zip
Merge pull request #4782 from ethereum/encodePackedArrayOfStructs
Encode packed array of structs
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol9
-rw-r--r--test/libsolidity/syntaxTests/specialFunctions/encode_array_of_struct.sol10
2 files changed, 19 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol b/test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol
new file mode 100644
index 00000000..036e108a
--- /dev/null
+++ b/test/libsolidity/syntaxTests/specialFunctions/encodePacked_array_of_structs.sol
@@ -0,0 +1,9 @@
+contract C {
+ struct S { uint x; }
+ function f() public pure {
+ S[] memory s;
+ abi.encodePacked(s);
+ }
+}
+// ----
+// TypeError: (116-117): This type cannot be encoded.
diff --git a/test/libsolidity/syntaxTests/specialFunctions/encode_array_of_struct.sol b/test/libsolidity/syntaxTests/specialFunctions/encode_array_of_struct.sol
new file mode 100644
index 00000000..7a4d8250
--- /dev/null
+++ b/test/libsolidity/syntaxTests/specialFunctions/encode_array_of_struct.sol
@@ -0,0 +1,10 @@
+pragma experimental ABIEncoderV2;
+contract C {
+ struct S { uint x; }
+ function f() public pure {
+ S[] memory s;
+ abi.encode(s);
+ }
+}
+// ----
+// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.