From be5720c18ca6768c7e72d4258677952848db2bb4 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Wed, 1 Mar 2017 10:11:49 +0100 Subject: Add @tailrec to avoid regressions. --- compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala') diff --git a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala index d75c32fcc..44308012e 100644 --- a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala +++ b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala @@ -16,7 +16,9 @@ import SymUtils._ import dotty.tools.dotc.ast.tpd import dotty.tools.dotc.core.Phases.Phase import util.Property + import collection.mutable +import scala.annotation.tailrec /** This phase adds outer accessors to classes and traits that need them. * Compared to Scala 2.x, it tries to minimize the set of classes @@ -367,7 +369,7 @@ object ExplicitOuter { def path(start: Tree = This(ctx.owner.lexicallyEnclosingClass.asClass), toCls: Symbol = NoSymbol, count: Int = -1): Tree = try { - def loop(tree: Tree, count: Int): Tree = { + @tailrec def loop(tree: Tree, count: Int): Tree = { val treeCls = tree.tpe.widen.classSymbol val outerAccessorCtx = ctx.withPhaseNoLater(ctx.lambdaLiftPhase) // lambdalift mangles local class names, which means we cannot reliably find outer acessors anymore ctx.log(i"outer to $toCls of $tree: ${tree.tpe}, looking for ${outerAccName(treeCls.asClass)(outerAccessorCtx)} in $treeCls") -- cgit v1.2.3