From b50f9abef672221a4706f0819eca2cfc1068751c Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 26 Jun 2015 17:39:51 +0200 Subject: Drop Module flag from lifted symbols. Reason: A lifted module is no longer a module (i.e. singleton object) in the scope to which it is lifted. Fixes #689. --- src/dotty/tools/dotc/transform/LambdaLift.scala | 3 ++- tests/pending/run/t8002.scala | 19 ------------------- tests/run/i689.scala | 10 ++++++++++ tests/run/t8002.scala | 19 +++++++++++++++++++ 4 files changed, 31 insertions(+), 20 deletions(-) delete mode 100644 tests/pending/run/t8002.scala create mode 100644 tests/run/i689.scala create mode 100644 tests/run/t8002.scala diff --git a/src/dotty/tools/dotc/transform/LambdaLift.scala b/src/dotty/tools/dotc/transform/LambdaLift.scala index 043c92737..cefd283be 100644 --- a/src/dotty/tools/dotc/transform/LambdaLift.scala +++ b/src/dotty/tools/dotc/transform/LambdaLift.scala @@ -309,7 +309,8 @@ class LambdaLift extends MiniPhase with IdentityDenotTransformer { thisTransform local.copySymDenotation( owner = newOwner, name = newName(local), - initFlags = local.flags &~ InSuperCall | Private | maybeStatic, + initFlags = local.flags &~ (InSuperCall | Module) | Private | maybeStatic, + // drop Module because class is no longer a singleton in the lifted context. info = liftedInfo(local)).installAfter(thisTransform) if (local.isClass) for (member <- local.asClass.info.decls) diff --git a/tests/pending/run/t8002.scala b/tests/pending/run/t8002.scala deleted file mode 100644 index c27e83a46..000000000 --- a/tests/pending/run/t8002.scala +++ /dev/null @@ -1,19 +0,0 @@ -object Test extends dotty.runtime.LegacyApp { - val a: Any = { - class A private () { private def x = 0; A.y }; - object A { - def a = new A().x - private def y = 0 - } - A.a - } - def b: Any = { - object A { - def a = new A().x - private def y = 0 - } - class A private () { private def x = 0; A.y }; - A.a - } - b -} diff --git a/tests/run/i689.scala b/tests/run/i689.scala new file mode 100644 index 000000000..262d13852 --- /dev/null +++ b/tests/run/i689.scala @@ -0,0 +1,10 @@ +object Test { + def main(args: Array[String]): Unit = { + object A { + def a = new A + def y = 0 + } + class A { A.y } + A.a + } +} diff --git a/tests/run/t8002.scala b/tests/run/t8002.scala new file mode 100644 index 000000000..c27e83a46 --- /dev/null +++ b/tests/run/t8002.scala @@ -0,0 +1,19 @@ +object Test extends dotty.runtime.LegacyApp { + val a: Any = { + class A private () { private def x = 0; A.y }; + object A { + def a = new A().x + private def y = 0 + } + A.a + } + def b: Any = { + object A { + def a = new A().x + private def y = 0 + } + class A private () { private def x = 0; A.y }; + A.a + } + b +} -- cgit v1.2.3