blob: 3f51ed48ede784edd22704fe24312a1091f4b39c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
object Test {
type Tag[X] = {type Tag = X}
type TaggedArray[T] = Array[T] with Tag[Any]
def method[T: scala.reflect.ClassTag](a: TaggedArray[T], value: T): Unit = {
a.update(0, value)
a foreach println
}
def main(args: Array[String]): Unit = {
method(Array(1, 2).asInstanceOf[TaggedArray[Int]], 1)
}
}
|