summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/CleanUp.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-11-06 14:15:25 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-11-06 14:15:25 +0100
commited3709a5dfd84f073a9a99e43418f693adbac07c (patch)
treeab1b04a4893109a7e0e3a831f86bddb16714672d /src/compiler/scala/tools/nsc/transform/CleanUp.scala
parent757a3a738cbb373f8f10fdc1f01e9ab6176a7076 (diff)
downloadscala-ed3709a5dfd84f073a9a99e43418f693adbac07c.tar.gz
scala-ed3709a5dfd84f073a9a99e43418f693adbac07c.tar.bz2
scala-ed3709a5dfd84f073a9a99e43418f693adbac07c.zip
Revert "Refactor guards checking for a particular overload of Array.apply."
This reverts commit 092345a24c22a821204fb358d33272ae8f7353be.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/CleanUp.scala')
-rw-r--r--src/compiler/scala/tools/nsc/transform/CleanUp.scala11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
index 3b74cb1168..6af7b78181 100644
--- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala
+++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala
@@ -624,10 +624,17 @@ 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_genericApply =>
+ if (wrapRefArrayMeth.symbol == Predef_wrapRefArray &&
+ appMeth.symbol == ArrayModule_overloadedApply.suchThat {
+ _.tpe.resultType.dealias.typeSymbol == ObjectClass // [T: ClassTag](xs: T*): Array[T] post erasure
+ }) =>
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) =>
+ 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
+ } =>
super.transform(rest.copy(elems = elem0 :: rest.elems))
case _ =>