summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-11-04 14:44:59 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-11-04 14:44:59 +0100
commit092345a24c22a821204fb358d33272ae8f7353be (patch)
treeafac2668593cb4af8df42772e124608b7d39c294 /src/compiler
parent8265175ecc42293997d59049f430396c77a2b891 (diff)
downloadscala-092345a24c22a821204fb358d33272ae8f7353be.tar.gz
scala-092345a24c22a821204fb358d33272ae8f7353be.tar.bz2
scala-092345a24c22a821204fb358d33272ae8f7353be.zip
Refactor guards checking for a particular overload of Array.apply.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/transform/CleanUp.scala11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
index 4f145d3d7e..61f2dd39d5 100644
--- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala
+++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
@@ -624,17 +624,10 @@ 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_overloadedApply.suchThat {
- tp => tp.tpe.paramss.flatten.lift.apply(1).exists(_.tpe.typeSymbol == SeqClass) &&
- tp.tpe.resultType =:= arrayType(elemtpt.tpe) // (p1: AnyVal1, ps: AnyVal1*): Array[AnyVal1] post erasure
- } =>
+ if wrapArrayMeth.symbol == Predef_wrapArray(elemtpt.tpe) && appMeth.symbol == ArrayModule_apply(elemtpt.tpe) =>
super.transform(rest.copy(elems = elem0 :: rest.elems))
case _ =>