From f7535f72903f083b2444fb1d0b73363efa5482e9 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Sat, 31 Mar 2012 12:52:54 -0700 Subject: Pushed Symbol/Type creation partitioning further. Yet more funnelling of immutable creation-time known information into the identities of symbols and types. --- src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala | 4 ++-- src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 1 + src/compiler/scala/tools/nsc/typechecker/Typers.scala | 9 +++++---- 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/compiler/scala/tools/nsc/typechecker') diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala index 764823d786..49ddb985dc 100644 --- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala @@ -317,7 +317,7 @@ trait ContextErrors { } withAddendum(qual.pos)( if (name == nme.CONSTRUCTOR) target + " does not have a constructor" - else nameString + " is not a member of " + targetKindString + target + addendum + else nameString + " is not a member of " + targetKindString + target.directObjectString + addendum ) } issueNormalTypeError(sel, errMsg) @@ -677,7 +677,7 @@ trait ContextErrors { def AccessError(tree: Tree, sym: Symbol, pre: Type, owner0: Symbol, explanation: String) = { def errMsg = { - val location = if (sym.isClassConstructor) owner0 else pre.widen + val location = if (sym.isClassConstructor) owner0 else pre.widen.directObjectString underlyingSymbol(sym).fullLocationString + " cannot be accessed in " + location + explanation diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 9177aca656..045614e773 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -267,6 +267,7 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R sym1.locationString + (if (sym1.isAliasType) ", which equals "+self.memberInfo(sym1) else if (sym1.isAbstractType) " with bounds"+self.memberInfo(sym1) + else if (sym1.isModule) "" else if (sym1.isTerm) " of type "+self.memberInfo(sym1) else "") else "") diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index ae184d2677..2aff00f6a5 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -253,22 +253,23 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { /** Check that `tpt` refers to a class type with a stable prefix. */ def checkStablePrefixClassType(tpt: Tree): Boolean = { val tpe = unwrapToStableClass(tpt.tpe) - def prefixIsStable = { def checkPre = tpe match { case TypeRef(pre, _, _) => pre.isStable || errorNotStable(tpt, pre) - case _ => true + case _ => false } // A type projection like X#Y can get by the stable check if the // prefix is singleton-bounded, so peek at the tree too. def checkTree = tpt match { - case SelectFromTypeTree(qual, _) => isSingleType(qual.tpe) || errorNotStable(tpt, qual.tpe) + case SelectFromTypeTree(qual, _) => isSingleType(qual.tpe) || errorNotClass(tpt, tpe) case _ => true } checkPre && checkTree } - isNonRefinementClassType(tpe) && (isPastTyper || prefixIsStable) + ( (isNonRefinementClassType(tpe) || errorNotClass(tpt, tpe)) + && (isPastTyper || prefixIsStable) + ) } /** Check that type tp is not a subtype of itself. -- cgit v1.2.3