summaryrefslogtreecommitdiff
path: root/src/library/scala/Function2.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-04-28 12:37:12 -0700
committerPaul Phillips <paulp@improving.org>2012-04-28 13:57:20 -0700
commit3404d5a9bf750e7022934d6b70035718544be900 (patch)
tree067fed298aa344177f0db807eb43c2c8ad36f04e /src/library/scala/Function2.scala
parent14144be0bcd3f6823a9622c6f962aed295ef3392 (diff)
downloadscala-3404d5a9bf750e7022934d6b70035718544be900.tar.gz
scala-3404d5a9bf750e7022934d6b70035718544be900.tar.bz2
scala-3404d5a9bf750e7022934d6b70035718544be900.zip
@unspecialized annotation.
Suppresses specialization on a per-method basis. I would have preferred to call it @nospecialize, but seeing as the positive form of the annotation is @specialized, that would have sown unnecessary grammatical confusion. @nospecialized sounds a bit too caveman for my tastes. "Grog no specialized! Grog generic!"
Diffstat (limited to 'src/library/scala/Function2.scala')
-rw-r--r--src/library/scala/Function2.scala11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/library/scala/Function2.scala b/src/library/scala/Function2.scala
index cacb96ef5d..0794a4048a 100644
--- a/src/library/scala/Function2.scala
+++ b/src/library/scala/Function2.scala
@@ -11,7 +11,7 @@ package scala
/** A function of 2 parameters.
- *
+ *
* In the following example, the definition of max is a
* shorthand for the anonymous class definition anonfun2:
*
@@ -23,7 +23,7 @@ package scala
* def apply(x: Int, y: Int): Int = if (x < y) y else x
* }
* assert(max(0, 1) == anonfun2(0, 1))
- * }
+ * }
* }}}
*
* Note that `Function1` does not define a total function, as might
@@ -40,16 +40,17 @@ trait Function2[@specialized(scala.Int, scala.Long, scala.Double) -T1, @speciali
/** Creates a curried version of this function.
*
* @return a function `f` such that `f(x1)(x2) == apply(x1, x2)`
- */ def curried: T1 => T2 => R = {
+ */
+ @annotation.unspecialized def curried: T1 => T2 => R = {
(x1: T1) => (x2: T2) => apply(x1, x2)
}
-
/** Creates a tupled version of this function: instead of 2 arguments,
* it accepts a single [[scala.Tuple2]] argument.
*
* @return a function `f` such that `f((x1, x2)) == f(Tuple2(x1, x2)) == apply(x1, x2)`
*/
- def tupled: Tuple2[T1, T2] => R = {
+
+ @annotation.unspecialized def tupled: Tuple2[T1, T2] => R = {
case Tuple2(x1, x2) => apply(x1, x2)
}
override def toString() = "<function2>"