From 3f58ea87b7e1da459ea9f574df5453e46583c9c5 Mon Sep 17 00:00:00 2001 From: Jon Pretty Date: Thu, 25 Jan 2024 11:21:33 +0100 Subject: [PATCH] Handle unitless multiplication case --- src/core/quantity.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/core/quantity.scala b/src/core/quantity.scala index e5355cf..b1b26ad 100644 --- a/src/core/quantity.scala +++ b/src/core/quantity.scala @@ -334,6 +334,15 @@ object QuantitativeMacros: ${QuantitativeMacros.multiply[LeftType, RightType]('left, 'right, false)} .asInstanceOf[Quantity[resultType]] } + + case None => + '{ + new MulOperator[Quantity[LeftType], Quantity[RightType]]: + type Result = Double + def div(left: Quantity[LeftType], right: Quantity[RightType]): Double = + ${QuantitativeMacros.multiply[LeftType, RightType]('left, 'right, false)}.asInstanceOf[Double] + } + def divTypeclass [LeftType <: Measure: Type, RightType <: Measure: Type]