diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-01-29 09:15:36 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-01-31 16:50:13 +0100 |
commit | d0afd7ece04e1974093c8c37b0ff6654742ab57b (patch) | |
tree | db2f4f0e30eae93cf1c9721ffb351634020829e4 /test/files/run/t7700.scala | |
parent | a5b0fc49e517d1c63d22f9909ac9bed0552ed466 (diff) | |
download | scala-d0afd7ece04e1974093c8c37b0ff6654742ab57b.tar.gz scala-d0afd7ece04e1974093c8c37b0ff6654742ab57b.tar.bz2 scala-d0afd7ece04e1974093c8c37b0ff6654742ab57b.zip |
SI-7700 @unspecialized, Part Deux: Now Working.
This annotation was introduced to allow us to mark methods within
a specialized trait as immune from specialization. In particular,
this is desirable for `Function1.{andThen, compose}`.
However, it seems we need to check for this in two places in the
specialization code base. The feature is now backed with a test.
Diffstat (limited to 'test/files/run/t7700.scala')
-rw-r--r-- | test/files/run/t7700.scala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/files/run/t7700.scala b/test/files/run/t7700.scala new file mode 100644 index 0000000000..76d16b808c --- /dev/null +++ b/test/files/run/t7700.scala @@ -0,0 +1,17 @@ +import scala.annotation._ + +trait C[@specialized U] { + @unspecialized + def foo(u: U): U + @unspecialized + def bar[A](u: U) = u +} + +object Test extends App { + val declared = classOf[C[_]].getDeclaredMethods.sortBy(_.getName) + println(declared.mkString("\n")) + object CInt extends C[Int] { def foo(i: Int) = i } + object CAny extends C[Any] { def foo(a: Any) = a } + assert(CInt.foo(1) == 1) + assert(CAny.foo("") == "") +} |