summaryrefslogtreecommitdiff
path: root/src/library/scala/math/Integral.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-03-19 15:27:19 +0000
committerPaul Phillips <paulp@improving.org>2011-03-19 15:27:19 +0000
commit5bb967a3de039830dcc453bb92d3b6a0b794684f (patch)
treecc33748f925b4c0f307bd23b4b442c57f9b2046a /src/library/scala/math/Integral.scala
parent8f0ff8bc2aaaa5299ebe4f617ab9e28443f994bd (diff)
downloadscala-5bb967a3de039830dcc453bb92d3b6a0b794684f.tar.gz
scala-5bb967a3de039830dcc453bb92d3b6a0b794684f.tar.bz2
scala-5bb967a3de039830dcc453bb92d3b6a0b794684f.zip
Some boundary conditions in range.
infix implicits to Integral and Fractional. As a bonus this patch knocked 10,000 long boxings off a specialized test. Who knew. Closes #4308, #4321, review by community.
Diffstat (limited to 'src/library/scala/math/Integral.scala')
-rw-r--r--src/library/scala/math/Integral.scala11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/library/scala/math/Integral.scala b/src/library/scala/math/Integral.scala
index 9c1deaea33..bb364a79b4 100644
--- a/src/library/scala/math/Integral.scala
+++ b/src/library/scala/math/Integral.scala
@@ -24,3 +24,14 @@ trait Integral[T] extends Numeric[T] {
}
override implicit def mkNumericOps(lhs: T): IntegralOps = new IntegralOps(lhs)
}
+
+object Integral {
+ trait ExtraImplicits {
+ /** The regrettable design of Numeric/Integral/Fractional has them all
+ * bumping into one another when searching for this implicit, so they
+ * are exiled into their own companions.
+ */
+ implicit def infixIntegralOps[T](x: T)(implicit num: Integral[T]): Integral[T]#IntegralOps = new num.IntegralOps(x)
+ }
+ object Implicits extends ExtraImplicits
+} \ No newline at end of file