Issue error properly for oversized arrays for calldata

This commit is contained in:
Alex Beregszaszi
2017-07-13 22:33:46 +02:00
parent 63bf0f68e6
commit cb4875a28b
4 changed files with 25 additions and 2 deletions
+6
View File
@@ -583,6 +583,12 @@ bool TypeChecker::visit(VariableDeclaration const& _variable)
!FunctionType(_variable).interfaceFunctionType()
)
m_errorReporter.typeError(_variable.location(), "Internal type is not allowed for public state variables.");
if (varType->category() == Type::Category::Array)
if (auto arrayType = dynamic_cast<ArrayType const*>(varType.get()))
if ((arrayType->location() == DataLocation::CallData) && !arrayType->validForCalldata())
m_errorReporter.typeError(_variable.location(), "Array is too large to be encoded as calldata.");
return false;
}