summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2008-11-26 18:58:03 +0000
committerIulian Dragos <jaguarul@gmail.com>2008-11-26 18:58:03 +0000
commitb31dcbdcf503b96536ed4b538d5a3eb14431f785 (patch)
treea45e7e61e6d898c386c6b8e9fef111f539868522 /src
parented4693400b490334a90490d3557198cb10e3d923 (diff)
downloadscala-b31dcbdcf503b96536ed4b538d5a3eb14431f785.tar.gz
scala-b31dcbdcf503b96536ed4b538d5a3eb14431f785.tar.bz2
scala-b31dcbdcf503b96536ed4b538d5a3eb14431f785.zip
Fixed 1541.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/transform/TailCalls.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
index 3c174d9b97..582b632d32 100644
--- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala
+++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala
@@ -253,8 +253,12 @@ abstract class TailCalls extends Transform
isRecursiveCall(fun)) {
fun match {
case Select(receiver, _) =>
- // make sure the type of 'this' doesn't change through this recursive call
- if (!forMSIL && (receiver.tpe.widen == ctx.currentMethod.enclClass.typeOfThis))
+ val recTpe = receiver.tpe.widen
+ val enclTpe = ctx.currentMethod.enclClass.typeOfThis
+ // make sure the type of 'this' doesn't change through this polymorphic recursive call
+ if (!forMSIL &&
+ (receiver.tpe.typeParams.isEmpty ||
+ (receiver.tpe.widen == ctx.currentMethod.enclClass.typeOfThis)))
rewriteTailCall(fun, receiver :: transformTrees(vargs, mkContext(ctx, false)))
else
defaultTree