From 17eaa1165794536643ac1c50122a11a5e06a7441 Mon Sep 17 00:00:00 2001 From: Djordje Mijovic Date: Mon, 31 May 2021 15:54:37 +0200 Subject: [PATCH] [Sol->Yul] Adding assertion in order to give better error messages for fixed point types. --- libsolidity/codegen/ir/IRGeneratorForStatements.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 7c00338b1..a62f40abf 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -2718,7 +2718,8 @@ string IRGeneratorForStatements::binaryOperation( solAssert( _type.category() == Type::Category::Integer || _type.category() == Type::Category::FixedBytes, - ""); + "" + ); switch (_operator) { case Token::BitOr: fun = "or"; break; @@ -2729,6 +2730,10 @@ string IRGeneratorForStatements::binaryOperation( } else if (TokenTraits::isArithmeticOp(_operator)) { + solUnimplementedAssert( + _type.category() != Type::Category::FixedPoint, + "Not yet implemented - FixedPointType." + ); IntegerType const* type = dynamic_cast(&_type); solAssert(type, ""); bool checked = m_context.arithmetic() == Arithmetic::Checked; @@ -2765,7 +2770,8 @@ std::string IRGeneratorForStatements::shiftOperation( ) { solUnimplementedAssert( - _amountToShift.type().category() != Type::Category::FixedPoint, + _amountToShift.type().category() != Type::Category::FixedPoint && + _value.type().category() != Type::Category::FixedPoint, "Not yet implemented - FixedPointType." ); IntegerType const* amountType = dynamic_cast(&_amountToShift.type());