diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2012-11-04 14:17:25 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2012-11-07 08:28:21 +0100 |
commit | cac5a08611f9511ba4d94b99db630404efae190a (patch) | |
tree | edfda31a5cfb514a744b3e632ebff960147aacac /src/compiler | |
parent | fe86aedf4acbb16159c8036edeadbda0bd380771 (diff) | |
download | scala-cac5a08611f9511ba4d94b99db630404efae190a.tar.gz scala-cac5a08611f9511ba4d94b99db630404efae190a.tar.bz2 scala-cac5a08611f9511ba4d94b99db630404efae190a.zip |
Optimize primitive Array(e1, ..., en)
Expands an existing optimization for reference arrays to
apply to primitives, as well.
Fixes one aspect of SI-6247.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/CleanUp.scala | 8 |
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..5318f98fa8 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(rest.copy(elems = elem0 :: rest.elems).copyAttrs(rest)) case _ => super.transform(tree) |