diff --git a/src/dotty/tools/dotc/transform/LambdaLift.scala b/src/dotty/tools/dotc/transform/LambdaLift.scala index 42c6e85af4d1..0cbbb769f458 100644 --- a/src/dotty/tools/dotc/transform/LambdaLift.scala +++ b/src/dotty/tools/dotc/transform/LambdaLift.scala @@ -292,7 +292,7 @@ class LambdaLift extends MiniPhase with IdentityDenotTransformer { thisTransform val encClass = local.enclosingClass val topClass = local.topLevelClass // member of a static object - if (encClass.isStatic && encClass.isProperlyContainedIn(topClass)) { + if (encClass.isStatic && encClass.isContainedIn(topClass)) { // though the second condition seems weird, it's not true for symbols which are defined in some // weird combinations of super calls. (encClass, EmptyFlags) diff --git a/tests/run/innerInObject.check b/tests/run/innerInObject.check new file mode 100644 index 000000000000..1191247b6d9a --- /dev/null +++ b/tests/run/innerInObject.check @@ -0,0 +1,2 @@ +1 +2 diff --git a/tests/run/innerInObject.scala b/tests/run/innerInObject.scala new file mode 100644 index 000000000000..5a5ece416d99 --- /dev/null +++ b/tests/run/innerInObject.scala @@ -0,0 +1,24 @@ +object Test { + def foo(x: Int) = { + println(x) + } + + def outer(x: Int) = { + def inner() = { + foo(x) + } + inner() + } + + def outer2(x: Int) = { + def inner2() = { + Test.foo(x) + } + inner2() + } + + def main(args: Array[String]): Unit = { + outer(1) + outer2(2) + } +}