diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-05-08 11:13:14 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-05-08 11:13:14 +0200 |
commit | b0856feefb90d1c0647bb3725ed9797fc76e0603 (patch) | |
tree | cd6c5d335ac59eea427681fe76d626c534ffc586 /src/dotty/tools/dotc/transform/LambdaLift.scala | |
parent | a52ca600f2ad427276d1cdabd56133ffd0ed7610 (diff) | |
download | dotty-b0856feefb90d1c0647bb3725ed9797fc76e0603.tar.gz dotty-b0856feefb90d1c0647bb3725ed9797fc76e0603.tar.bz2 dotty-b0856feefb90d1c0647bb3725ed9797fc76e0603.zip |
Fix #545: no need to make members of static classes static.
Otherwise we will need to rewrite references to `This` of class be references on ModuleVal.
This is less efficient(instead of calling method statically known to be final, you have virtual call) and less jvm-friendly,
as needs additional instructions to get to ModuleVal.
Diffstat (limited to 'src/dotty/tools/dotc/transform/LambdaLift.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/LambdaLift.scala | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/LambdaLift.scala b/src/dotty/tools/dotc/transform/LambdaLift.scala index 7be0a12ab..bac088928 100644 --- a/src/dotty/tools/dotc/transform/LambdaLift.scala +++ b/src/dotty/tools/dotc/transform/LambdaLift.scala @@ -288,7 +288,13 @@ class LambdaLift extends MiniPhase with IdentityDenotTransformer { thisTransform private def liftLocals()(implicit ctx: Context): Unit = { for ((local, lOwner) <- liftedOwner) { val (newOwner, maybeStatic) = - if (lOwner is Package) (local.topLevelClass, JavaStatic) + if (lOwner is Package) { + println(s"lifting $local encl class ${local.enclosingClass}") + if (local.enclosingClass.isStatic) // member of a static object + (local.enclosingClass, EmptyFlags) + else + (local.topLevelClass, JavaStatic) + } else (lOwner, EmptyFlags) local.copySymDenotation( owner = newOwner, |