diff options
author | Paul Phillips <paulp@improving.org> | 2010-12-03 23:53:58 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-12-03 23:53:58 +0000 |
commit | 9e9914e109c91cd4f86802129c236827517d8386 (patch) | |
tree | 7cb656bc2b54f13e53b2d55db59c10c418296c77 /src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala | |
parent | e1a0866ce748ee1a228060f401dbb190d3caa8c3 (diff) | |
download | scala-9e9914e109c91cd4f86802129c236827517d8386.tar.gz scala-9e9914e109c91cd4f86802129c236827517d8386.tar.bz2 scala-9e9914e109c91cd4f86802129c236827517d8386.zip |
Starting the mopping up now that names have som...
Starting the mopping up now that names have some more sense of their
place in the universe. Cleaned up some heavy multi-boolean logic. Added
more documentation on the relationships between entities in Symbols and
some other compiler things which often blur together.
Fun fact: the incorrect usage of nme.ScalaObject in Contexts which I
reported when first broaching the namespace subject became a compile
time error during the writing of this patch, because there is no longer
any such thing as nme.ScalaObject. It's a little bit like magic. No
review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala index ebcd3c3777..22a60a8abf 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala @@ -234,18 +234,16 @@ trait TypeDiagnostics { // functions to manipulate the name def preQualify() = modifyName(trueOwner.fullName + "." + _) def postQualify() = modifyName(_ + "(in " + trueOwner + ")") - def scalaQualify() = if (isInScalaOrPredef) preQualify() + def scalaQualify() = if (inPredefOrScala) preQualify() def typeQualify() = if (sym.isTypeParameterOrSkolem) postQualify() def nameQualify() = if (trueOwner.isPackageClass) preQualify() else postQualify() - def trueOwner = tp.typeSymbol.ownerSkipPackageObject - def aliasOwner = tp.typeSymbolDirect.ownerSkipPackageObject + def trueOwner = tp.typeSymbol.owner.skipPackageObject + def aliasOwner = tp.typeSymbolDirect.owner.skipPackageObject def owners = List(trueOwner, aliasOwner) - def isInScalaOrPredef = owners exists { - case ScalaPackageClass | PredefModuleClass => true - case _ => false - } + private def scalaAndPredef = Set(ScalaPackageClass, PredefModuleClass) + def inPredefOrScala = owners exists scalaAndPredef def sym_==(other: TypeDiag) = tp.typeSymbol == other.tp.typeSymbol def owner_==(other: TypeDiag) = trueOwner == other.trueOwner @@ -264,9 +262,9 @@ trait TypeDiagnostics { |tp.typeSymbol.owner = %s |tp.typeSymbolDirect = %s |tp.typeSymbolDirect.owner = %s - |isInScalaOrPredef = %s + |inPredefOrScala = %s """.stripMargin.format( - tp, tp.typeSymbol, tp.typeSymbol.owner, tp.typeSymbolDirect, tp.typeSymbolDirect.owner, isInScalaOrPredef + tp, tp.typeSymbol, tp.typeSymbol.owner, tp.typeSymbolDirect, tp.typeSymbolDirect.owner, inPredefOrScala ) } } |