From edbe9edbbe4cf52ec6f885919253bf7ce4979b38 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 12 Sep 2014 02:27:10 +0200 Subject: Skip label methods in enclosing method Otherwise would spuriously treat variables referenced from while loops as captured, because their enclosing method differs from current enclosing method. --- src/dotty/tools/dotc/core/SymDenotations.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala') diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index 049c8185f..c9777ebf6 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -666,7 +666,7 @@ object SymDenotations { * A local dummy owner is mapped to the primary constructor of the class. */ final def enclosingMethod(implicit ctx: Context): Symbol = - if (this is Method) symbol + if (this is (Method, butNot = Label)) symbol else if (this.isClass) primaryConstructor else owner.enclosingMethod @@ -1320,6 +1320,8 @@ object SymDenotations { baseTypeRefOf(tp1) & baseTypeRefOf(tp2) case OrType(tp1, tp2) => baseTypeRefOf(tp1) | baseTypeRefOf(tp2) + case JavaArrayType(_) if symbol == defn.ObjectClass => + this.typeRef case _ => NoType } -- cgit v1.2.3