aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dark@d-d.me>2017-03-15 10:04:20 +0100
committerGitHub <noreply@github.com>2017-03-15 10:04:20 +0100
commit141fb4b8c63e5b9cbbb1b92f55412e676a38cbf0 (patch)
treecab94bb63bad887672534d4d3f078506a0a9ce59 /compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala
parent934da77590dad2003fe850b48b2ae01b427508f0 (diff)
parentbe5720c18ca6768c7e72d4258677952848db2bb4 (diff)
downloaddotty-141fb4b8c63e5b9cbbb1b92f55412e676a38cbf0.tar.gz
dotty-141fb4b8c63e5b9cbbb1b92f55412e676a38cbf0.tar.bz2
dotty-141fb4b8c63e5b9cbbb1b92f55412e676a38cbf0.zip
Merge pull request #2043 from dotty-staging/tailrec-derivesFrom
Tailrec for derivesFrom/lookupRefined/classSymbol/classSymbols
Diffstat (limited to 'compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/compiler/src/dotty/tools/dotc/transform/ExplicitOuter.scala
index 88c92685f..f17808e62 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")