Assign cast from constants directly

This commit is contained in:
Leo Alt 2021-05-11 14:07:02 +02:00
parent 299dae4d1a
commit e2959ce55c

View File

@ -1113,6 +1113,14 @@ void SMTEncoder::visitTypeConversion(FunctionCall const& _funCall)
{
solAssert(smt::isNumber(*funCallType), "");
RationalNumberType const* rationalType = isConstant(*argument);
if (rationalType)
{
// The TypeChecker guarantees that a constant fits in the cast size.
defineExpr(_funCall, symbArg);
return;
}
auto const* fixedCast = dynamic_cast<FixedBytesType const*>(funCallType);
auto const* fixedArg = dynamic_cast<FixedBytesType const*>(argType);
if (fixedCast && fixedArg)