mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Issue error properly for oversized arrays for calldata
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user