blob: 76d16b808c5201efd544e574cfa21462cd7869ed (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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("") == "")
}
|