diff --git a/src/main/scala/millfork/env/Constant.scala b/src/main/scala/millfork/env/Constant.scala index a5097b0b..eaa6d5f1 100644 --- a/src/main/scala/millfork/env/Constant.scala +++ b/src/main/scala/millfork/env/Constant.scala @@ -263,6 +263,8 @@ case class CompoundConstant(operator: MathOperator.Value, lhs: Constant, rhs: Co } else { CompoundConstant(MathOperator.Minus, a, rr - ll).quickSimplify } + case (CompoundConstant(MathOperator.Plus, a, ll@NumericConstant(lv, _)), b) if operator == MathOperator.Minus && a == b => + ll.quickSimplify case (CompoundConstant(MathOperator.Minus, a, ll@NumericConstant(lv, _)), rr@NumericConstant(rv, _)) if operator == MathOperator.Plus => if (lv >= rv) { CompoundConstant(MathOperator.Minus, a, ll - rr).quickSimplify