diff options
author | Martin Odersky <odersky@gmail.com> | 2015-05-04 10:50:33 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-05-04 10:50:40 +0200 |
commit | 7bf29f00c85a0efe59bbca548767dcd21ec2b14e (patch) | |
tree | 030896b39c850fd8ef0f1b9d04386b4145875d04 /src/dotty/tools/dotc/transform/ExplicitOuter.scala | |
parent | 4808d1ddf94ddfcab5e6b5dd9a8d2a3b003b89e0 (diff) | |
download | dotty-7bf29f00c85a0efe59bbca548767dcd21ec2b14e.tar.gz dotty-7bf29f00c85a0efe59bbca548767dcd21ec2b14e.tar.bz2 dotty-7bf29f00c85a0efe59bbca548767dcd21ec2b14e.zip |
Treat references to modules and lazy vals as outer references
Previously, we considered only methods. #503 shows that this is wrong.
Diffstat (limited to 'src/dotty/tools/dotc/transform/ExplicitOuter.scala')
-rw-r--r-- | src/dotty/tools/dotc/transform/ExplicitOuter.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/ExplicitOuter.scala b/src/dotty/tools/dotc/transform/ExplicitOuter.scala index 20e367e1f..09f0d695d 100644 --- a/src/dotty/tools/dotc/transform/ExplicitOuter.scala +++ b/src/dotty/tools/dotc/transform/ExplicitOuter.scala @@ -213,7 +213,7 @@ object ExplicitOuter { case id: Ident => id.tpe match { case ref @ TermRef(NoPrefix, _) => - ref.symbol.is(Method) && isOuter(id.symbol.owner.enclosingClass) + ref.symbol.is(Hoistable) && isOuter(id.symbol.owner.enclosingClass) // methods will be placed in enclosing class scope by LambdaLift, so they will get // an outer path then. case _ => false @@ -225,6 +225,8 @@ object ExplicitOuter { } } + private final val Hoistable = Method | Lazy | Module + /** The outer prefix implied by type `tpe` */ private def outerPrefix(tpe: Type)(implicit ctx: Context): Type = tpe match { case tpe: TypeRef => |