diff options
author | Martin Odersky <odersky@gmail.com> | 2014-09-12 02:27:10 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-09-12 02:27:10 +0200 |
commit | edbe9edbbe4cf52ec6f885919253bf7ce4979b38 (patch) | |
tree | 90bbc649a18a099b770075860c8540de0fd571df /src/dotty/tools/dotc/core/SymDenotations.scala | |
parent | 97828b370d9b5e0a4c5b4ec5b1da1c174e417df9 (diff) | |
download | dotty-edbe9edbbe4cf52ec6f885919253bf7ce4979b38.tar.gz dotty-edbe9edbbe4cf52ec6f885919253bf7ce4979b38.tar.bz2 dotty-edbe9edbbe4cf52ec6f885919253bf7ce4979b38.zip |
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.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 4 |
1 files changed, 3 insertions, 1 deletions
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 } |