Skip to content

Commit 0ecd49a

Browse files
committed
fix #2163: don't narrow liftedOwner if symbol is InSuperCall
1 parent 318700f commit 0ecd49a

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ class LambdaLift extends MiniPhase with IdentityDenotTransformer { thisTransform
146146
def narrowLiftedOwner(sym: Symbol, owner: Symbol)(implicit ctx: Context) =
147147
if (sym.maybeOwner.isTerm &&
148148
owner.isProperlyContainedIn(liftedOwner(sym)) &&
149+
!sym.is(InSuperCall) &&
149150
owner != sym) {
150151
ctx.log(i"narrow lifted $sym to $owner")
151152
changedLiftedOwner = true

tests/run/i2163.check

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7

tests/run/i2163.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Base(f: Int => Int) {
2+
f(3)
3+
}
4+
5+
class Child(x: Int) extends Base(y => x + y)
6+
7+
object Test {
8+
def main(args: Array[String]): Unit = new Child(4)
9+
}

0 commit comments

Comments
 (0)