diff options
author | Paul Phillips <paulp@improving.org> | 2012-04-28 12:37:12 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-04-28 13:57:20 -0700 |
commit | 3404d5a9bf750e7022934d6b70035718544be900 (patch) | |
tree | 067fed298aa344177f0db807eb43c2c8ad36f04e /src/library/scala/Function1.scala | |
parent | 14144be0bcd3f6823a9622c6f962aed295ef3392 (diff) | |
download | scala-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/Function1.scala')
-rw-r--r-- | src/library/scala/Function1.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/library/scala/Function1.scala b/src/library/scala/Function1.scala index 8995ef912b..f9b37fc6bd 100644 --- a/src/library/scala/Function1.scala +++ b/src/library/scala/Function1.scala @@ -11,7 +11,7 @@ package scala /** A function of 1 parameter. - * + * * In the following example, the definition of succ is a * shorthand for the anonymous class definition anonfun1: * @@ -22,7 +22,7 @@ package scala * def apply(x: Int): Int = x + 1 * } * assert(succ(0) == anonfun1(0)) - * } + * } * }}} * * Note that `Function1` does not define a total function, as might @@ -44,7 +44,7 @@ trait Function1[@specialized(scala.Int, scala.Long, scala.Float, scala.Double, s * @param g a function A => T1 * @return a new function `f` such that `f(x) == apply(g(x))` */ - def compose[A](g: A => T1): A => R = { x => apply(g(x)) } + @annotation.unspecialized def compose[A](g: A => T1): A => R = { x => apply(g(x)) } /** Composes two instances of Function1 in a new Function1, with this function applied first. * @@ -52,7 +52,7 @@ trait Function1[@specialized(scala.Int, scala.Long, scala.Float, scala.Double, s * @param g a function R => A * @return a new function `f` such that `f(x) == g(apply(x))` */ - def andThen[A](g: R => A): T1 => A = { x => g(apply(x)) } + @annotation.unspecialized def andThen[A](g: R => A): T1 => A = { x => g(apply(x)) } override def toString() = "<function1>" } |