mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
changed names for Rational Constants and categories
This commit is contained in:
1 parent
4d283b2b30
commit
4b749fc333
6 files changed
+53
-49
No files matched your search
@@ -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.");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user