diff options
-rwxr-xr-x | sources/scala/tools/nsc/symtab/Types.scala | 6 | ||||
-rwxr-xr-x | sources/scala/tools/nsc/typechecker/Typers.scala | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/sources/scala/tools/nsc/symtab/Types.scala b/sources/scala/tools/nsc/symtab/Types.scala index 640366545d..dc48b51cd9 100755 --- a/sources/scala/tools/nsc/symtab/Types.scala +++ b/sources/scala/tools/nsc/symtab/Types.scala @@ -135,7 +135,7 @@ import Flags._; */ def decl(name: Name): Symbol = findDecl(name, 0); - /** The non-orivate defined or declared members with name `name' in this type; + /** The non-private defined or declared members with name `name' in this type; * an OverloadedSymbol if several exist, NoSymbol if none exist. * Alternatives of overloaded symbol appear in the order they are declared. */ @@ -161,6 +161,10 @@ import Flags._; * an OverloadedSymbol if several exist, NoSymbol if none exist */ def nonPrivateMember(name: Name): Symbol = findMember(name, PRIVATE | BRIDGE, 0); + /** The non-local member with given name, + * an OverloadedSymbol if several exist, NoSymbol if none exist */ + def nonLocalMember(name: Name): Symbol = findMember(name, LOCAL | BRIDGE, 0); + /** The least type instance of given class which is a supertype * of this type */ def baseType(clazz: Symbol): Type = NoType; diff --git a/sources/scala/tools/nsc/typechecker/Typers.scala b/sources/scala/tools/nsc/typechecker/Typers.scala index a161349a34..7046e4c163 100755 --- a/sources/scala/tools/nsc/typechecker/Typers.scala +++ b/sources/scala/tools/nsc/typechecker/Typers.scala @@ -930,9 +930,12 @@ import collection.mutable.HashMap; "\n phase = " + phase); } tree.symbol - } else { - qual.tpe.member(name) - } + } else qual.tpe match { + case ThisType(clazz) if (clazz == context.enclClass.owner) => + qual.tpe.member(name) + case _ => + qual.tpe.nonLocalMember(name) + } if (sym == NoSymbol && qual.isTerm && (qual.symbol == null || qual.symbol.isValue) && !phase.erasedTypes && !qual.tpe.widen.isError) { val coercion = inferView(qual.pos, qual.tpe, name, true); |