From 4229caaadc1767571806a11ea431c5cf389081ac Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Thu, 13 Jul 2017 17:02:10 +0200 Subject: [PATCH] Disable large arrays for memory location too --- libsolidity/analysis/TypeChecker.cpp | 6 +++++- test/libsolidity/SolidityNameAndTypeResolution.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 56f9c764c..29db7441e 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -586,7 +586,11 @@ bool TypeChecker::visit(VariableDeclaration const& _variable) if (varType->category() == Type::Category::Array) if (auto arrayType = dynamic_cast(varType.get())) - if ((arrayType->location() == DataLocation::CallData) && !arrayType->validForCalldata()) + if ( + ((arrayType->location() == DataLocation::Memory) || + (arrayType->location() == DataLocation::CallData)) && + !arrayType->validForCalldata() + ) m_errorReporter.typeError(_variable.location(), "Array is too large to be encoded as calldata."); return false; diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index dccedbfd1..36b48cfd7 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -6319,7 +6319,7 @@ BOOST_AUTO_TEST_CASE(too_large_arrays_for_calldata) } } )"; - CHECK_SUCCESS_NO_WARNINGS(text); + CHECK_ERROR(text, TypeError, "Array is too large to be encoded as calldata."); } BOOST_AUTO_TEST_SUITE_END()