aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-04-05 21:52:25 +0800
committerchriseth <chris@ethereum.org>2018-04-12 22:37:16 +0800
commit75b88286667690ffb4a5e079665ed8b70bcaeb87 (patch)
treeee0952b521768895b329f3e91dfa0a98eb2b4cef /test/libsolidity/syntaxTests
parent7343c4028365d3fbc9fa46fca6078971a2bed426 (diff)
downloaddexon-solidity-75b88286667690ffb4a5e079665ed8b70bcaeb87.tar
dexon-solidity-75b88286667690ffb4a5e079665ed8b70bcaeb87.tar.gz
dexon-solidity-75b88286667690ffb4a5e079665ed8b70bcaeb87.tar.bz2
dexon-solidity-75b88286667690ffb4a5e079665ed8b70bcaeb87.tar.lz
dexon-solidity-75b88286667690ffb4a5e079665ed8b70bcaeb87.tar.xz
dexon-solidity-75b88286667690ffb4a5e079665ed8b70bcaeb87.tar.zst
dexon-solidity-75b88286667690ffb4a5e079665ed8b70bcaeb87.zip
Allow struct encoding with new encoder.
Diffstat (limited to 'test/libsolidity/syntaxTests')
-rw-r--r--test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs.sol17
-rw-r--r--test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs_abiv2.sol18
-rw-r--r--test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol9
-rw-r--r--test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs_abiv2.sol16
4 files changed, 55 insertions, 5 deletions
diff --git a/test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs.sol b/test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs.sol
new file mode 100644
index 00000000..d9eebee4
--- /dev/null
+++ b/test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs.sol
@@ -0,0 +1,17 @@
+contract C {
+ struct S { uint x; }
+ S s;
+ struct T { uint y; }
+ T t;
+ function f() public view {
+ abi.encode(s, t);
+ }
+ function g() public view {
+ abi.encodePacked(s, t);
+ }
+}
+// ----
+// TypeError: (131-132): This type cannot be encoded.
+// TypeError: (134-135): This type cannot be encoded.
+// TypeError: (200-201): This type cannot be encoded.
+// TypeError: (203-204): This type cannot be encoded.
diff --git a/test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs_abiv2.sol b/test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs_abiv2.sol
new file mode 100644
index 00000000..d6cf60e4
--- /dev/null
+++ b/test/libsolidity/syntaxTests/specialFunctions/abi_encode_structs_abiv2.sol
@@ -0,0 +1,18 @@
+pragma experimental ABIEncoderV2;
+
+contract C {
+ struct S { uint x; }
+ S s;
+ struct T { uint y; }
+ T t;
+ function f() public view {
+ abi.encode(s, t);
+ }
+ function g() public view {
+ abi.encodePacked(s, t);
+ }
+}
+// ----
+// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
+// TypeError: (235-236): This type cannot be encoded.
+// TypeError: (238-239): This type cannot be encoded.
diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol
index cc354819..fa910260 100644
--- a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol
+++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs.sol
@@ -1,14 +1,13 @@
contract C {
struct S { uint x; }
S s;
- struct T { }
+ struct T { uint y; }
T t;
- function f() public pure {
+ function f() public view {
bytes32 a = sha256(s, t);
a;
}
}
// ----
-// Warning: (51-63): Defining empty structs is deprecated.
-// TypeError: (131-132): This type cannot be encoded.
-// TypeError: (134-135): This type cannot be encoded.
+// TypeError: (139-140): This type cannot be encoded.
+// TypeError: (142-143): This type cannot be encoded.
diff --git a/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs_abiv2.sol b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs_abiv2.sol
new file mode 100644
index 00000000..1187ce4a
--- /dev/null
+++ b/test/libsolidity/syntaxTests/specialFunctions/types_with_unspecified_encoding_structs_abiv2.sol
@@ -0,0 +1,16 @@
+pragma experimental ABIEncoderV2;
+
+contract C {
+ struct S { uint x; }
+ S s;
+ struct T { uint y; }
+ T t;
+ function f() public view {
+ bytes32 a = sha256(s, t);
+ a;
+ }
+}
+// ----
+// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
+// TypeError: (174-175): This type cannot be encoded.
+// TypeError: (177-178): This type cannot be encoded.