aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-03-06 22:51:17 +0800
committerGitHub <noreply@github.com>2018-03-06 22:51:17 +0800
commit83dacbf669f58ad40e3035837d4ea8a846c46949 (patch)
treef9f2f1fd434fbe1949bd6f9407ecd62bae47c8fe /test
parent0df4c64884d1b8d3695dd59de5f828ba5298b313 (diff)
parent98e8a9385456b5d3fe3ca7ef2e0c923b0aab2ea3 (diff)
downloaddexon-solidity-83dacbf669f58ad40e3035837d4ea8a846c46949.tar
dexon-solidity-83dacbf669f58ad40e3035837d4ea8a846c46949.tar.gz
dexon-solidity-83dacbf669f58ad40e3035837d4ea8a846c46949.tar.bz2
dexon-solidity-83dacbf669f58ad40e3035837d4ea8a846c46949.tar.lz
dexon-solidity-83dacbf669f58ad40e3035837d4ea8a846c46949.tar.xz
dexon-solidity-83dacbf669f58ad40e3035837d4ea8a846c46949.tar.zst
dexon-solidity-83dacbf669f58ad40e3035837d4ea8a846c46949.zip
Merge pull request #3549 from ethereum/fixmultidim
Properly detect which array and struct types are unsupported by the old ABI encoder.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index b6e2cd43..87d62973 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -978,6 +978,62 @@ BOOST_AUTO_TEST_CASE(functions_with_stucts_of_non_external_types_in_interface_ne
CHECK_ERROR(text, TypeError, "Internal or recursive type is not allowed for public or external functions.");
}
+BOOST_AUTO_TEST_CASE(returning_multi_dimensional_arrays_new_abi)
+{
+ char const* text = R"(
+ pragma experimental ABIEncoderV2;
+
+ contract C {
+ function f() public pure returns (string[][]) {}
+ }
+ )";
+ CHECK_WARNING(text, "Experimental features");
+}
+
+BOOST_AUTO_TEST_CASE(returning_multi_dimensional_arrays)
+{
+ char const* text = R"(
+ contract C {
+ function f() public pure returns (string[][]) {}
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "only supported in the new experimental ABI encoder");
+}
+
+BOOST_AUTO_TEST_CASE(returning_multi_dimensional_static_arrays)
+{
+ char const* text = R"(
+ contract C {
+ function f() public pure returns (uint[][2]) {}
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "only supported in the new experimental ABI encoder");
+}
+
+BOOST_AUTO_TEST_CASE(returning_arrays_in_structs_new_abi)
+{
+ char const* text = R"(
+ pragma experimental ABIEncoderV2;
+
+ contract C {
+ struct S { string[] s; }
+ function f() public pure returns (S) {}
+ }
+ )";
+ CHECK_WARNING(text, "Experimental features");
+}
+
+BOOST_AUTO_TEST_CASE(returning_arrays_in_structs_arrays)
+{
+ char const* text = R"(
+ contract C {
+ struct S { string[] s; }
+ function f() public pure returns (S x) {}
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "only supported in the new experimental ABI encoder");
+}
+
BOOST_AUTO_TEST_CASE(function_external_call_allowed_conversion)
{
char const* text = R"(