diff options
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/ReferencesResolver.cpp | 2 | ||||
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index 9f83971b..a7b9e8b8 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -104,7 +104,7 @@ void ReferencesResolver::endVisit(ArrayTypeName const& _typeName) if (!length->annotation().type) ConstantEvaluator e(*length); auto const* lengthType = dynamic_cast<RationalNumberType const*>(length->annotation().type.get()); - if (!lengthType || lengthType->denominator() != 1) + if (!lengthType || lengthType->isFractional()) fatalTypeError(length->location(), "Invalid array length, expected integer literal."); else _typeName.annotation().type = make_shared<ArrayType>(DataLocation::Storage, baseType, lengthType->literalValue(nullptr)); diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index f28e08ab..6df9aae0 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -792,7 +792,7 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement) { if ( valueComponentType->category() == Type::Category::RationalNumber && - dynamic_cast<RationalNumberType const&>(*valueComponentType).denominator() != 1 && + dynamic_cast<RationalNumberType const&>(*valueComponentType).isFractional() && valueComponentType->mobileType() ) typeError( @@ -1366,9 +1366,9 @@ bool TypeChecker::visit(IndexAccess const& _access) expectType(*index, IntegerType(256)); if (auto numberType = dynamic_cast<RationalNumberType const*>(type(*index).get())) { - solAssert(!numberType->denominator() != 1 ,"Invalid type for array access."); - if (!actualType.isDynamicallySized() && actualType.length() <= numberType->literalValue(nullptr)) - typeError(_access.location(), "Out of bounds array access."); + if (!numberType->isFractional()) // error is reported above + if (!actualType.isDynamicallySized() && actualType.length() <= numberType->literalValue(nullptr)) + typeError(_access.location(), "Out of bounds array access."); } } resultType = actualType.baseType(); @@ -1522,7 +1522,7 @@ void TypeChecker::expectType(Expression const& _expression, Type const& _expecte { if ( type(_expression)->category() == Type::Category::RationalNumber && - dynamic_pointer_cast<RationalNumberType const>(type(_expression))->denominator() != 1 && + dynamic_pointer_cast<RationalNumberType const>(type(_expression))->isFractional() && type(_expression)->mobileType() ) typeError( |