Skip to content

Commit 58c50d9

Browse files
authored
Merge pull request scala#7178 from milessabin/topic/t10035
Don't recurse without bound in outerPath
2 parents 1ecf2fc + 37ec8dd commit 58c50d9

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,11 @@ abstract class ExplicitOuter extends InfoTransform
264264
protected def outerPath(base: Tree, from: Symbol, to: Symbol): Tree = {
265265
//Console.println("outerPath from "+from+" to "+to+" at "+base+":"+base.tpe)
266266
if (from == to) base
267-
else outerPath(outerSelect(base), from.outerClass, to)
267+
else {
268+
val outerSel = outerSelect(base)
269+
if (outerSel.isEmpty) EmptyTree
270+
else outerPath(outerSel, from.outerClass, to)
271+
}
268272
}
269273

270274

test/files/pos/t10035.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
trait Inner {
2+
def f(): Outer
3+
}
4+
5+
class Outer(o: Set[Inner]) {
6+
def this() = this(Set(1).map{
7+
case k => new Inner {
8+
def f(): Outer = Outer.this
9+
}
10+
})
11+
}

0 commit comments

Comments
 (0)