Disallow ambiguous conversions between number literals and bytesXX types.

This commit is contained in:
Daniel Kirchner
2018-08-13 14:27:01 +02:00
parent 43db88b836
commit 7d7abeb149
26 changed files with 316 additions and 126 deletions
-16
View File
@@ -2348,22 +2348,6 @@ void TypeChecker::expectType(Expression const& _expression, Type const& _expecte
"."
);
}
if (
type(_expression)->category() == Type::Category::RationalNumber &&
_expectedType.category() == Type::Category::FixedBytes
)
{
auto literal = dynamic_cast<Literal const*>(&_expression);
if (literal && !literal->isHexNumber())
m_errorReporter.warning(
_expression.location(),
"Decimal literal assigned to bytesXX variable will be left-aligned. "
"Use an explicit conversion to silence this warning."
);
}
}
void TypeChecker::requireLValue(Expression const& _expression)