diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2008-11-26 18:58:03 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2008-11-26 18:58:03 +0000 |
commit | b31dcbdcf503b96536ed4b538d5a3eb14431f785 (patch) | |
tree | a45e7e61e6d898c386c6b8e9fef111f539868522 /src/compiler | |
parent | ed4693400b490334a90490d3557198cb10e3d923 (diff) | |
download | scala-b31dcbdcf503b96536ed4b538d5a3eb14431f785.tar.gz scala-b31dcbdcf503b96536ed4b538d5a3eb14431f785.tar.bz2 scala-b31dcbdcf503b96536ed4b538d5a3eb14431f785.zip |
Fixed 1541.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/TailCalls.scala | 8 |
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 |