summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2016-08-12 22:04:26 +1000
committerJakob Odersky <jakob@odersky.com>2016-08-12 14:26:31 -0700
commit56e4402fc267dcd1957f0aee0c756e88ca569482 (patch)
tree9fb848898cfb4b11fb9a9fb595a523c10a5e57c3 /src
parent708dd680b3e28c6344c3f45c2aea09cf1d3b5908 (diff)
downloadscala-56e4402fc267dcd1957f0aee0c756e88ca569482.tar.gz
scala-56e4402fc267dcd1957f0aee0c756e88ca569482.tar.bz2
scala-56e4402fc267dcd1957f0aee0c756e88ca569482.zip
Java joint compilation: tweak static lookup impl
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala11
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala6
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)