File tree 3 files changed +18
-0
lines changed
compiler/src/dotty/tools/dotc/transform
3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -202,6 +202,7 @@ class LambdaLift extends MiniPhase with IdentityDenotTransformer { thisTransform
202
202
ctx.debuglog(i " mark free: ${sym.showLocated} with owner ${sym.maybeOwner} marked free in $enclosure" )
203
203
val intermediate =
204
204
if (enclosure.is(PackageClass )) enclosure
205
+ else if (enclosure.isConstructor) markFree(sym, enclosure.owner.enclosure)
205
206
else markFree(sym, enclosure.enclosure)
206
207
narrowLiftedOwner(enclosure, intermediate orElse sym.enclosingClass)
207
208
if (! intermediate.isRealClass || enclosure.isConstructor) {
Original file line number Diff line number Diff line change
1
+
Original file line number Diff line number Diff line change
1
+ class Wrapper (val value : Int )
2
+
3
+ abstract class Foo (val x : Int )
4
+
5
+ class Test {
6
+ def foo (wrapper : Wrapper ): Unit = {
7
+ new Foo (wrapper.value) {}
8
+ }
9
+ }
10
+ object Test extends App {
11
+ def foo (wrapper : Wrapper ): Foo =
12
+ new Foo (wrapper.value) {}
13
+ def printFields (obj : Any ) =
14
+ println(obj.getClass.getDeclaredFields.map(_.toString).sorted.deep.mkString(" \n " ))
15
+ printFields(foo(new Wrapper (1 )))
16
+ }
You can’t perform that action at this time.
0 commit comments