Disallow calldata arrays with dynamically encoded base types in TypeChecker.

This commit is contained in:
Daniel Kirchner
2019-02-11 17:13:12 +01:00
parent 92cb6cb793
commit 9e32aa7510
7 changed files with 52 additions and 0 deletions
+10
View File
@@ -366,6 +366,16 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
for (ASTPointer<VariableDeclaration> const& var: _function.parameters())
{
TypePointer baseType = type(*var);
if (auto const* arrayType = dynamic_cast<ArrayType const*>(baseType.get()))
{
baseType = arrayType->baseType();
if (
!m_scope->isInterface() &&
baseType->dataStoredIn(DataLocation::CallData) &&
baseType->isDynamicallyEncoded()
)
m_errorReporter.typeError(var->location(), "Calldata arrays with dynamically encoded base types are not yet supported.");
}
while (auto const* arrayType = dynamic_cast<ArrayType const*>(baseType.get()))
baseType = arrayType->baseType();