diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/TailCalls.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/TailCalls.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/TailCalls.scala b/src/compiler/scala/tools/nsc/transform/TailCalls.scala index 1575ec1384..adeab550ee 100644 --- a/src/compiler/scala/tools/nsc/transform/TailCalls.scala +++ b/src/compiler/scala/tools/nsc/transform/TailCalls.scala @@ -72,7 +72,7 @@ abstract class TailCalls extends Transform * are optimized. Since 'this' is not a local variable, a dummy local val * is added and used as a label parameter. The backend knows to load * the corresponding argument in the 'this' (local at index 0). This dummy local - * is never used and should be cleand up by dead code elmination (when enabled). + * is never used and should be cleand up by dead code elimination (when enabled). * </p> * <p> * This phase has been moved before pattern matching to catch more @@ -162,7 +162,7 @@ abstract class TailCalls extends Transform newCtx.label.setInfo(MethodType(currentClassParam :: tree.symbol.tpe.params, tree.symbol.tpe.finalResultType)) newCtx.tailPos = true - val isEligible = newCtx.currentMethod.isFinal || (newCtx.currentMethod.enclClass hasFlag Flags.MODULE) + val isEligible = newCtx.currentMethod.isEffectivelyFinal || (newCtx.currentMethod.enclClass hasFlag Flags.MODULE) // If -Ytailrecommend is given, we speculatively try transforming ineligible methods and // report where we would have been successful. val recommend = settings.Ytailrec.value @@ -270,7 +270,7 @@ abstract class TailCalls extends Transform case Apply(tapply @ TypeApply(fun, targs), vargs) => lazy val defaultTree = treeCopy.Apply(tree, tapply, transformTrees(vargs, mkContext(ctx, false))) - if ( ctx.currentMethod.isFinal && + if ( ctx.currentMethod.isEffectivelyFinal && ctx.tailPos && isSameTypes(ctx.tparams, targs map (_.tpe.typeSymbol)) && isRecursiveCall(fun)) { @@ -299,7 +299,7 @@ abstract class TailCalls extends Transform case Apply(fun, args) => lazy val defaultTree = treeCopy.Apply(tree, fun, transformTrees(args, mkContext(ctx, false))) - if (ctx.currentMethod.isFinal && + if (ctx.currentMethod.isEffectivelyFinal && ctx.tailPos && isRecursiveCall(fun)) { fun match { |