diff --git a/src/ast2ram/AstToRamTranslator.cpp b/src/ast2ram/AstToRamTranslator.cpp index 67d5df12d35..6cfca6a54bc 100644 --- a/src/ast2ram/AstToRamTranslator.cpp +++ b/src/ast2ram/AstToRamTranslator.cpp @@ -243,9 +243,8 @@ Own AstToRamTranslator::translateValue(const ast::Argument* arg } Own visitNumericConstant(const ast::NumericConstant& c) override { - assert(c.getType().has_value() && "At this points all constants should have type."); - - switch (*c.getType()) { + assert(!polyAnalysis->hasInvalidType(&c) && "constant should have valid type"); + switch (polyAnalysis->getOverloadedType(&c)) { case ast::NumericConstant::Type::Int: return mk(RamSignedFromString(c.getConstant(), nullptr, 0)); case ast::NumericConstant::Type::Uint: @@ -400,8 +399,8 @@ RamDomain AstToRamTranslator::getConstantRamRepresentation(const ast::Constant& } else if (isA(&constant)) { return 0; } else if (auto* numConstant = dynamic_cast(&constant)) { - assert(numConstant->getType().has_value()); - switch (*numConstant->getType()) { + assert(!polyAnalysis->hasInvalidType(numConstant) && "constant should have valid type"); + switch (polyAnalysis->getOverloadedType(numConstant)) { case ast::NumericConstant::Type::Int: return RamSignedFromString(numConstant->getConstant(), nullptr, 0); case ast::NumericConstant::Type::Uint: @@ -417,7 +416,7 @@ Own AstToRamTranslator::translateConstant(ast::Constant const& auto const rawConstant = getConstantRamRepresentation(c); if (auto* const c_num = dynamic_cast(&c)) { - switch (*c_num->getType()) { + switch (polyAnalysis->getOverloadedType(c_num)) { case ast::NumericConstant::Type::Int: return mk(rawConstant); case ast::NumericConstant::Type::Uint: return mk(rawConstant); case ast::NumericConstant::Type::Float: return mk(rawConstant);