diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 11 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 6 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index 16ef75c863..c73ea54c3d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -1016,7 +1016,16 @@ trait Contexts { self: Analyzer => || unit.exists && s.sourceFile != unit.source.file ) ) - def lookupInPrefix(name: Name) = pre member name filter qualifies + def lookupInPrefix(name: Name) = { + val sym = pre.member(name).filter(qualifies) + def isNonPackageNoModuleClass(sym: Symbol) = + sym.isClass && !sym.isModuleClass && !sym.isPackageClass + if (!sym.exists && unit.isJava && isNonPackageNoModuleClass(pre.typeSymbol)) { + // TODO factor out duplication with Typer::inCompanionForJavaStatic + val pre1 = companionSymbolOf(pre.typeSymbol, this).typeOfThis + pre1.member(name).filter(qualifies).andAlso(_ => pre = pre1) + } else sym + } def accessibleInPrefix(s: Symbol) = isAccessible(s, pre, superAccess = false) def searchPrefix = { diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index ad58859f25..eabd35cd1f 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -4885,11 +4885,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper nameLookup match { case LookupAmbiguous(msg) => issue(AmbiguousIdentError(tree, name, msg)) case LookupInaccessible(sym, msg) => issue(AccessError(tree, sym, context, msg)) - case LookupNotFound => - inCompanionForJavaStatic(NoPrefix, context.enclClass.owner, name) orElse inEmptyPackage orElse lookupInRoot(name) match { - case NoSymbol => issue(SymbolNotFoundError(tree, name, context.owner, startContext)) - case sym => typed1(tree setSymbol sym, mode, pt) - } + case LookupNotFound => issue(SymbolNotFoundError(tree, name, context.owner, startContext)) case LookupSucceeded(qual, sym) => (// this -> Foo.this if (sym.isThisSym) |