diff options
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index ad93b38c..fb0c665c 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -773,8 +773,8 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement) // Infer type from value. solAssert(!var.typeName(), ""); if ( - valueComponentType->category() == Type::Category::NumberConstant && - !dynamic_pointer_cast<ConstantNumberType const>(valueComponentType)->integerType() + valueComponentType->category() == Type::Category::RationalNumber && + !dynamic_pointer_cast<RationalNumberType const>(valueComponentType)->integerType() ) fatalTypeError(_statement.initialValue()->location(), "Invalid integer constant " + valueComponentType->toString() + "."); var.annotation().type = valueComponentType->mobileType(); @@ -799,8 +799,8 @@ bool TypeChecker::visit(VariableDeclarationStatement const& _statement) void TypeChecker::endVisit(ExpressionStatement const& _statement) { - if (type(_statement.expression())->category() == Type::Category::NumberConstant) - if (!dynamic_pointer_cast<ConstantNumberType const>(type(_statement.expression()))->integerType()) + if (type(_statement.expression())->category() == Type::Category::RationalNumber) + if (!dynamic_pointer_cast<RationalNumberType const>(type(_statement.expression()))->integerType()) typeError(_statement.expression().location(), "Invalid integer constant."); } @@ -1106,7 +1106,7 @@ bool TypeChecker::visit(FunctionCall const& _functionCall) auto const& argType = type(*arguments[i]); if (functionType->takesArbitraryParameters()) { - if (auto t = dynamic_cast<ConstantNumberType const*>(argType.get())) + if (auto t = dynamic_cast<RationalNumberType const*>(argType.get())) if (!t->integerType()) typeError(arguments[i]->location(), "Integer constant too large."); } @@ -1341,7 +1341,7 @@ bool TypeChecker::visit(IndexAccess const& _access) else { expectType(*index, IntegerType(256)); - if (auto numberType = dynamic_cast<ConstantNumberType const*>(type(*index).get())) + if (auto numberType = dynamic_cast<RationalNumberType const*>(type(*index).get())) { if (numberType->denominator() != 1) typeError(_access.location(), "Invalid type for array access."); @@ -1372,7 +1372,7 @@ bool TypeChecker::visit(IndexAccess const& _access) else { index->accept(*this); - if (auto length = dynamic_cast<ConstantNumberType const*>(type(*index).get())) + if (auto length = dynamic_cast<RationalNumberType const*>(type(*index).get())) resultType = make_shared<TypeType>(make_shared<ArrayType>( DataLocation::Memory, typeType.actualType(), @@ -1391,7 +1391,7 @@ bool TypeChecker::visit(IndexAccess const& _access) else { expectType(*index, IntegerType(256)); - if (auto integerType = dynamic_cast<ConstantNumberType const*>(type(*index).get())) + if (auto integerType = dynamic_cast<RationalNumberType const*>(type(*index).get())) if (bytesType.numBytes() <= integerType->literalValue(nullptr)) typeError(_access.location(), "Out of bounds array access."); } |