summaryrefslogtreecommitdiff
path: root/test/files/run/arraytags_usage.scala
blob: 507e91987b918659d179461effd12d2fe34e58ef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import scala.reflect.{ArrayTag, arrayTag}

object Test extends App {
  def foo[T] = {
    class MyArrayTag extends ArrayTag[T] {
      def wrap: ArrayTag[Array[T]] = ???
      def newArray(len: Int): Array[T] = new Array[Int](len).asInstanceOf[Array[T]]
    }

    implicit val tag = new MyArrayTag()
    println(Array[T]().getClass)
  }

  foo[Int]
  foo[String]
  foo[Array[String]]
}