summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2012-11-16 15:57:11 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2012-11-16 15:57:11 -0800
commit52ec695a98608128be2429d813fc5a045a092988 (patch)
treec620fe7acb58fcbe59196153b9face7b1b80a3ed /src/compiler
parent6645fec23ab3ee7d12f5cfc7c474a42f0eb7ec15 (diff)
parenta7cc894ff2b4c5b661890272ec401cde12da3f9e (diff)
downloadscala-52ec695a98608128be2429d813fc5a045a092988.tar.gz
scala-52ec695a98608128be2429d813fc5a045a092988.tar.bz2
scala-52ec695a98608128be2429d813fc5a045a092988.zip
Merge pull request #1586 from retronym/ticket/6247
Optimize primitive Array(e1, ..., en)
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/transform/CleanUp.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
index 16f6c80101..847ca574a9 100644
--- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala
+++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
@@ -624,11 +624,11 @@ abstract class CleanUp extends Transform with ast.TreeDSL {
//
// See SI-6611; we must *only* do this for literal vararg arrays.
case Apply(appMeth, List(Apply(wrapRefArrayMeth, List(arg @ StripCast(ArrayValue(_, _)))), _))
- if (wrapRefArrayMeth.symbol == Predef_wrapRefArray &&
- appMeth.symbol == ArrayModule_overloadedApply.suchThat {
- _.tpe.resultType.dealias.typeSymbol == ObjectClass // [T: ClassTag](xs: T*): Array[T] post erasure
- }) =>
+ if wrapRefArrayMeth.symbol == Predef_wrapRefArray && appMeth.symbol == ArrayModule_genericApply =>
super.transform(arg)
+ case Apply(appMeth, List(elem0, Apply(wrapArrayMeth, List(rest @ ArrayValue(elemtpt, _)))))
+ if wrapArrayMeth.symbol == Predef_wrapArray(elemtpt.tpe) && appMeth.symbol == ArrayModule_apply(elemtpt.tpe) =>
+ super.transform(treeCopy.ArrayValue(rest, rest.elemtpt, elem0 :: rest.elems))
case _ =>
super.transform(tree)