1 2 3 4 5 6 7 8 9 10 11 12
// https://github.com/lampepfl/dotty/issues/1065 package hello object world { def mkArray(atype: Int): Array[_ <: AnyVal] = { (if (atype == 1) new Array[Int](10) else new Array[Float](10)) } def main(args: Array[String]): Unit = { println(mkArray(1)) } }