mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix missing annotation settings because of early return
This commit is contained in:
parent
858b4507e2
commit
76bb2cafe9
@ -2920,6 +2920,9 @@ bool TypeChecker::visit(IndexRangeAccess const& _access)
|
|||||||
isPure = false;
|
isPure = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_access.annotation().isLValue = isLValue;
|
||||||
|
_access.annotation().isPure = isPure;
|
||||||
|
|
||||||
TypePointer exprType = type(_access.baseExpression());
|
TypePointer exprType = type(_access.baseExpression());
|
||||||
if (exprType->category() == Type::Category::TypeType)
|
if (exprType->category() == Type::Category::TypeType)
|
||||||
{
|
{
|
||||||
@ -2934,14 +2937,11 @@ bool TypeChecker::visit(IndexRangeAccess const& _access)
|
|||||||
else if (!(arrayType = dynamic_cast<ArrayType const*>(exprType)))
|
else if (!(arrayType = dynamic_cast<ArrayType const*>(exprType)))
|
||||||
m_errorReporter.fatalTypeError(4781_error, _access.location(), "Index range access is only possible for arrays and array slices.");
|
m_errorReporter.fatalTypeError(4781_error, _access.location(), "Index range access is only possible for arrays and array slices.");
|
||||||
|
|
||||||
|
|
||||||
if (arrayType->location() != DataLocation::CallData || !arrayType->isDynamicallySized())
|
if (arrayType->location() != DataLocation::CallData || !arrayType->isDynamicallySized())
|
||||||
m_errorReporter.typeError(1227_error, _access.location(), "Index range access is only supported for dynamic calldata arrays.");
|
m_errorReporter.typeError(1227_error, _access.location(), "Index range access is only supported for dynamic calldata arrays.");
|
||||||
else if (arrayType->baseType()->isDynamicallyEncoded())
|
else if (arrayType->baseType()->isDynamicallyEncoded())
|
||||||
m_errorReporter.typeError(2148_error, _access.location(), "Index range access is not supported for arrays with dynamically encoded base types.");
|
m_errorReporter.typeError(2148_error, _access.location(), "Index range access is not supported for arrays with dynamically encoded base types.");
|
||||||
_access.annotation().type = TypeProvider::arraySlice(*arrayType);
|
_access.annotation().type = TypeProvider::arraySlice(*arrayType);
|
||||||
_access.annotation().isLValue = isLValue;
|
|
||||||
_access.annotation().isPure = isPure;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
// Used to trigger assert
|
||||||
|
contract s{}
|
||||||
|
function f() {s[:][];}
|
||||||
|
// ----
|
||||||
|
// TypeError 1760: (53-57): Types cannot be sliced.
|
||||||
|
// TypeError 2876: (53-59): Index access for contracts or libraries is not possible.
|
Loading…
Reference in New Issue
Block a user