diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-07-03 00:28:36 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-07-03 00:28:36 -0700 |
commit | b95294507f95f694269f696fa0e679f805f3bfd3 (patch) | |
tree | c34c7f68fb3fb6530b9c8fac90b5e9ef731c3437 | |
parent | 33936243bdf597e438de8d10ae7b3ed30454be9f (diff) | |
parent | 39f01d4f48e59c2037a3af759eb6d55d0da50e70 (diff) | |
download | scala-b95294507f95f694269f696fa0e679f805f3bfd3.tar.gz scala-b95294507f95f694269f696fa0e679f805f3bfd3.tar.bz2 scala-b95294507f95f694269f696fa0e679f805f3bfd3.zip |
Merge pull request #801 from paulp/issue/exponential-spec
Fix for exponential compile time in specialization.
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala | 7 | ||||
-rw-r--r-- | test/files/pos/exponential-spec.scala | 47 |
2 files changed, 52 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala index 124d350385..ffcb682cf7 100644 --- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala +++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala @@ -1366,7 +1366,7 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { override def transform(tree: Tree): Tree = reportError { transform1(tree) } {_ => tree} - + def transform1(tree: Tree) = { val symbol = tree.symbol @@ -1437,7 +1437,10 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers { localTyper.typedOperator(atPos(tree.pos)(tree1)) // being polymorphic, it must be a method } - case None => super.transform(tree) + case None => + treeCopy.TypeApply(tree, treeCopy.Select(sel, qual1, name), super.transformTrees(targs)) + // See pos/exponential-spec.scala - can't call transform on the whole tree again. + // super.transform(tree) } case Select(Super(_, _), name) if illegalSpecializedInheritance(currentClass) => diff --git a/test/files/pos/exponential-spec.scala b/test/files/pos/exponential-spec.scala new file mode 100644 index 0000000000..83aef58f7e --- /dev/null +++ b/test/files/pos/exponential-spec.scala @@ -0,0 +1,47 @@ +// a.scala +// Sat Jun 30 19:51:17 PDT 2012 + +trait Exp[T] + +object Test { + def f[T](exp: Exp[T]): Exp[T] = ( + f[T] _ + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] // 4s + compose f[T] // 5s + compose f[T] // 5s + compose f[T] // 6s + compose f[T] // 7s + compose f[T] // 8s + compose f[T] // 11s + compose f[T] // 17s + compose f[T] // 29s + compose f[T] // 54s + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + compose f[T] + )(exp) +} |