blob: 5f0114b9400fdbabff6d6db858667caec2f6bfc1 (
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) {
a.update(0, value)
a foreach println
}
def main(args: Array[String]): Unit = {
method(Array(1, 2).asInstanceOf[TaggedArray[Int]], 1)
}
}
|