Closed Roldak closed 9 years ago
Thanks @Roldak! First example should warn, the second one shouldn't. @milosstojanovic , can you please have a look? I might have broken the warnings in https://github.com/miniboxing/miniboxing-plugin/commit/d6b17854e3629abe721961707354b385ed9d2c57... :-1:
Yeah, I will have a look now.
Thanks Milos!
sun@sun-cpu:~/x$ cat i.scala
class C[T: reflect.ClassTag](t: T) {
new Array[T](4)
Array[T](t,t,t,t,t)
}
sun@sun-cpu:~/x$ scalac -Xprint:typer i.scala
Picked up _JAVA_OPTIONS: -Xms2g -Xmx2g -Xss4m -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=256m -XX:PermSize=256m -XX:+TieredCompilation -XX:+UseNUMA
[[syntax trees at end of typer]] // i.scala
package <empty> {
class C[T] extends scala.AnyRef {
<paramaccessor> private[this] val t: T = _;
implicit <synthetic> <paramaccessor> private[this] val evidence$1: scala.reflect.ClassTag[T] = _;
def <init>(t: T)(implicit evidence$1: scala.reflect.ClassTag[T]): C[T] = {
C.super.<init>();
()
};
C.this.evidence$1.newArray(4);
scala.Array.apply[T](C.this.t, C.this.t, C.this.t, C.this.t, C.this.t)(C.this.evidence$1)
}
}
This doesn't yield the warning "Use MbArray instead of Array and benefit from miniboxing specialization".
Btw, should this yield the warning too (it doesn't right now) ?