Disallow array slicing for arrays with dyanmically encoded base types.

This commit is contained in:
Daniel Kirchner
2020-05-13 15:52:22 +02:00
parent b2122d479f
commit 6f04664cfa
9 changed files with 53 additions and 6 deletions
+2
View File
@@ -2864,6 +2864,8 @@ bool TypeChecker::visit(IndexRangeAccess const& _access)
if (arrayType->location() != DataLocation::CallData || !arrayType->isDynamicallySized())
m_errorReporter.typeError(1227_error, _access.location(), "Index range access is only supported for dynamic calldata arrays.");
else if (arrayType->baseType()->isDynamicallyEncoded())
m_errorReporter.typeError(1878_error, _access.location(), "Index range access is not supported for arrays with dynamically encoded base types.");
_access.annotation().type = TypeProvider::arraySlice(*arrayType);
_access.annotation().isLValue = isLValue;
_access.annotation().isPure = isPure;