summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2012-05-05 20:58:32 -0700
committerSom Snytt <som.snytt@gmail.com>2012-05-20 17:06:44 -0700
commit01c673efd80d687b6ba3cec09059a024cec6e7c2 (patch)
tree322d15c090c4b4abca3c8b6d6c49404a04c47de4 /src
parent1f5584fbe183041d4af269278f0125e2f0b94a44 (diff)
downloadscala-01c673efd80d687b6ba3cec09059a024cec6e7c2.tar.gz
scala-01c673efd80d687b6ba3cec09059a024cec6e7c2.tar.bz2
scala-01c673efd80d687b6ba3cec09059a024cec6e7c2.zip
SI-5760: Improve error message for package$Klass conflict with Klass
Added a clarification to DoubleDefError for when the previous symbol was in the package object but current symbol is not. This was actually supposed to be an opportunity to hack partest to run the two-step failing compilation, but somebody beat me to it and my rebase failed. The next hacking opportunity might be to add .pt script files! The possibilities are endless.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
index cb01faf619..eb3a1ffb5b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
@@ -874,8 +874,12 @@ trait ContextErrors {
val s1 = if (prevSym.isModule) "case class companion " else ""
val s2 = if (prevSym.isSynthetic) "(compiler-generated) " + s1 else ""
val s3 = if (prevSym.isCase) "case class " + prevSym.name else "" + prevSym
+ val where = if (currentSym.owner.isPackageClass != prevSym.owner.isPackageClass) {
+ val inOrOut = if (prevSym.owner.isPackageClass) "outside of" else "in"
+ " %s package object %s".format(inOrOut, ""+prevSym.effectiveOwner.name)
+ } else ""
- issueSymbolTypeError(currentSym, prevSym.name + " is already defined as " + s2 + s3)
+ issueSymbolTypeError(currentSym, prevSym.name + " is already defined as " + s2 + s3 + where)
}
def MaxParametersCaseClassError(tree: Tree) =