summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-02-10 20:49:30 +0000
committerPaul Phillips <paulp@improving.org>2011-02-10 20:49:30 +0000
commit8e380b67366ab83d81fd401632af17d7cc0c2205 (patch)
treeb110ab274d8c82aa9ef7308b762f31a97087f3b0 /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parentd54ad45ded6f0220b17246592a4c07ccb9e09184 (diff)
downloadscala-8e380b67366ab83d81fd401632af17d7cc0c2205.tar.gz
scala-8e380b67366ab83d81fd401632af17d7cc0c2205.tar.bz2
scala-8e380b67366ab83d81fd401632af17d7cc0c2205.zip
Created invisible setting to expose empty packa...
Created invisible setting to expose empty package members outside of the empty package, so the repl can use packages without going blind to the empty package. This commit also eliminates a deadlock which hits when the compiler starts logging before a lazy val has pulled its head from the noose. Closes #4228, review by odersky.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 396bb5ca0e..d805a33940 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3575,6 +3575,14 @@ trait Typers extends Modes {
// for being inaccessible; used for error reporting
var inaccessibleExplanation: String = ""
+ // If a special setting is given, the empty package will be checked as a
+ // last ditch effort before failing. This method sets defSym and returns
+ // true if a member of the given name exists.
+ def checkEmptyPackage(): Boolean = {
+ defSym = EmptyPackageClass.tpe.nonPrivateMember(name)
+ defSym != NoSymbol
+ }
+
// A symbol qualifies if it exists and is not stale. Stale symbols
// are made to disappear here. In addition,
// if we are in a constructor of a pattern, we ignore all definitions
@@ -3679,15 +3687,20 @@ trait Typers extends Modes {
if (!(shortenImports && qual0.symbol.isPackage)) // optimization: don't write out package prefixes
qual = atPos(tree.pos.focusStart)(resetPos(qual0.duplicate))
pre = qual.tpe
- } else {
+ }
+ else if (settings.exposeEmptyPackage.value && checkEmptyPackage())
+ log("Allowing empty package member " + name + " due to settings.")
+ else {
if (settings.debug.value) {
log(context.imports)//debug
}
if (inaccessibleSym eq NoSymbol) {
error(tree.pos, "not found: "+decodeWithNamespace(name))
- } else accessError(
+ }
+ else accessError(
tree, inaccessibleSym, context.enclClass.owner.thisType,
- inaccessibleExplanation)
+ inaccessibleExplanation
+ )
defSym = context.owner.newErrorSymbol(name)
}
}