Skip to content

Commit 5cb4ecb

Browse files
committed
Narrow liftedOwner also for static objects
Lambdas should stay inside static objects if they reference to them with a This or Ident. Fixes test case `llist.scala` but demonstrates another problem.
1 parent 367c9d3 commit 5cb4ecb

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/dotty/tools/dotc/transform/LambdaLift.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,9 @@ class LambdaLift extends MiniPhase with IdentityDenotTransformer { thisTransform
189189
val sym = tree.symbol
190190
def narrowTo(thisClass: ClassSymbol) = {
191191
val enclClass = enclosure.enclosingClass
192-
if (!thisClass.isStaticOwner)
193-
narrowLiftedOwner(enclosure,
194-
if (enclClass.isContainedIn(thisClass)) thisClass
195-
else enclClass) // unknown this reference, play it safe and assume the narrowest possible owner
192+
narrowLiftedOwner(enclosure,
193+
if (enclClass.isContainedIn(thisClass)) thisClass
194+
else enclClass) // unknown this reference, play it safe and assume the narrowest possible owner
196195
}
197196
tree match {
198197
case tree: Ident =>

0 commit comments

Comments
 (0)