diff options
-rw-r--r-- | src/dotty/tools/dotc/transform/ExplicitOuter.scala | 4 | ||||
-rw-r--r-- | tests/pos/i503.scala | 9 |
2 files changed, 12 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 => diff --git a/tests/pos/i503.scala b/tests/pos/i503.scala new file mode 100644 index 000000000..93f275c4d --- /dev/null +++ b/tests/pos/i503.scala @@ -0,0 +1,9 @@ +class HelloWorld { + def main(args: Array[String]): Unit = { + object TypeBool; + + class Fct { + def g(x : Int) = TypeBool // breaks. + } + } +} |