Skip to content

Commit

Permalink
All dimensions were made to have implicit field equal to this.
Browse files Browse the repository at this point in the history
This allows us to have nice implicit instance when `Dimension[Q]` is a
companion object to some quantity.
  • Loading branch information
buzden committed Nov 28, 2018
1 parent 037d3ad commit b504f4c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions shared/src/main/scala/squants/Dimension.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ trait Dimension[A <: Quantity[A]] {
case None Failure(QuantityParseException(s"Unable to identify $name unit ${symbol}", s"(${Platform.crossFormat(num.toDouble(value))},${symbol})"))
}
}

implicit val dimensionImplicit: Dimension[A] = this
}

case class QuantityParseException(message: String, expression: String) extends Exception(s"$message:$expression")
Expand Down

0 comments on commit b504f4c

Please sign in to comment.