diff options
author | Paul Phillips <paulp@improving.org> | 2012-06-30 21:48:10 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-06-30 21:49:27 -0700 |
commit | 39f01d4f48e59c2037a3af759eb6d55d0da50e70 (patch) | |
tree | 0eaddcf9392702fb93c74179e2cee2c9cad3d582 | |
parent | 0a9cea6ea58571deb67d60193d60d12be6bb0233 (diff) | |
download | scala-39f01d4f48e59c2037a3af759eb6d55d0da50e70.tar.gz scala-39f01d4f48e59c2037a3af759eb6d55d0da50e70.tar.bz2 scala-39f01d4f48e59c2037a3af759eb6d55d0da50e70.zip |
Fix for exponential compile time in specialization.
Review by @prokopec.
-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) +} |