File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -41,15 +41,15 @@ class ArrayApply extends MiniPhase {
41
41
}
42
42
43
43
/** Only optimize when classtag if it is one of
44
- * - `ClassTag.apply(classOf[X ])`
45
- * - `ClassTag.apply(java.lang.XYZ.Type)`
46
- * - `ClassTag.{Byte, Boolean, ...}`
44
+ * - `ClassTag.apply(classOf[XYZ ])`
45
+ * - `ClassTag.apply(java.lang.XYZ.Type)` for boxed primitives `XYZ``
46
+ * - `ClassTag.XYZ` for primitive types
47
47
*/
48
48
private def elideClassTag (ct : Tree )(implicit ctx : Context ): Boolean = ct match {
49
49
case Apply (_, rc :: Nil ) if ct.symbol == defn.ClassTagModule_apply =>
50
50
rc match {
51
- case _ : Literal => true // classOf[X]
52
- case rc : RefTree if rc.name == nme.TYPE_ =>
51
+ case _ : Literal => true // ClassTag.apply( classOf[XYZ])
52
+ case rc : RefTree if rc.name == nme.TYPE_ => // ClassTag.apply(java.lang.XYZ.Type)
53
53
val owner = rc.symbol.maybeOwner.companionModule
54
54
owner == defn.BoxedBooleanModule || owner == defn.BoxedByteModule ||
55
55
owner == defn.BoxedShortModule || owner == defn.BoxedCharModule ||
@@ -59,6 +59,7 @@ class ArrayApply extends MiniPhase {
59
59
case _ => false
60
60
}
61
61
case Apply (ctm : RefTree , _) if ctm.symbol.maybeOwner.companionModule == defn.ClassTagModule =>
62
+ // ClassTag.XYZ
62
63
nme.ScalaValueNames .contains(ctm.name)
63
64
case _ => false
64
65
}
You can’t perform that action at this time.
0 commit comments