aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-07-14 05:07:34 +0800
committerGitHub <noreply@github.com>2017-07-14 05:07:34 +0800
commit556ddd0f381f532d322758e3e00485055e7d1ed0 (patch)
treecb96bf31298c1fd0c77ee9ab41299b23cfe52475 /test
parent63bf0f68e6d232eccf6d64ca2bba5b39e108ea41 (diff)
parent4229caaadc1767571806a11ea431c5cf389081ac (diff)
downloaddexon-solidity-556ddd0f381f532d322758e3e00485055e7d1ed0.tar
dexon-solidity-556ddd0f381f532d322758e3e00485055e7d1ed0.tar.gz
dexon-solidity-556ddd0f381f532d322758e3e00485055e7d1ed0.tar.bz2
dexon-solidity-556ddd0f381f532d322758e3e00485055e7d1ed0.tar.lz
dexon-solidity-556ddd0f381f532d322758e3e00485055e7d1ed0.tar.xz
dexon-solidity-556ddd0f381f532d322758e3e00485055e7d1ed0.tar.zst
dexon-solidity-556ddd0f381f532d322758e3e00485055e7d1ed0.zip
Merge pull request #2564 from ethereum/large-arrays-calldata
Add type error for arrays too large for calldata
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 472f1b97..36b48cfd 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -6297,6 +6297,31 @@ BOOST_AUTO_TEST_CASE(implicit_conversion_disallowed)
CHECK_ERROR(text, TypeError, "Return argument type uint32 is not implicitly convertible to expected type (type of first return variable) bytes4.");
}
+BOOST_AUTO_TEST_CASE(too_large_arrays_for_calldata)
+{
+ char const* text = R"(
+ contract C {
+ function f(uint[85678901234] a) external {
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Array is too large to be encoded as calldata.");
+ text = R"(
+ contract C {
+ function f(uint[85678901234] a) internal {
+ }
+ }
+ )";
+ CHECK_SUCCESS_NO_WARNINGS(text);
+ text = R"(
+ contract C {
+ function f(uint[85678901234] a) {
+ }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Array is too large to be encoded as calldata.");
+}
+
BOOST_AUTO_TEST_SUITE_END()
}