summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-01-07 19:07:01 +0000
committerPaul Phillips <paulp@improving.org>2011-01-07 19:07:01 +0000
commit32e7c243272d7aaae6c662aa3e1716dae61e1117 (patch)
treeec61af7fab062994641da341d5aea4c8aaf67fa3 /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent148736c3df1fa6463b4b2658c01bcf452a52c224 (diff)
downloadscala-32e7c243272d7aaae6c662aa3e1716dae61e1117.tar.gz
scala-32e7c243272d7aaae6c662aa3e1716dae61e1117.tar.bz2
scala-32e7c243272d7aaae6c662aa3e1716dae61e1117.zip
Great moments in code reuse:
def isRootOrEmptyPackageClass(s: Symbol) = s.isRoot || s.isEmptyPackageClass def isRootOrEmpty = (this == EmptyPackageClass) || (this == RootClass) def isEffectiveRoot = isRoot || isEmptyPackageClass // last one actually not quite identical def isUnqualified(n: Name) = n match { case nme.ROOT | nme.EMPTY_PACKAGE_NAME => true ; case _ => false } I was responsible for at least half of these. Now it's only isEffectiveRoot. Also, I have always found it warty that we have to specify Nothing and Any as upper bounds. I gave the TypeBounds companion object a few obvious methods: def empty: TypeBounds = apply(NothingClass.tpe, AnyClass.tpe) def upper(hi: Type): TypeBounds = apply(NothingClass.tpe, hi) def lower(lo: Type): TypeBounds = apply(lo, AnyClass.tpe) It's a lovable patch. No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 2099278fe3..bcb2767e6f 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3002,8 +3002,7 @@ trait Typers extends Modes {
if (isFullyDefined(pt))
context.owner.newAliasType(tree.pos, name) setInfo pt
else
- context.owner.newAbstractType(tree.pos, name) setInfo
- TypeBounds(NothingClass.tpe, AnyClass.tpe)
+ context.owner.newAbstractType(tree.pos, name) setInfo TypeBounds.empty
val rawInfo = vble.rawInfo
vble = if (vble.name == tpnme.WILDCARD) context.scope.enter(vble)
else namer.enterInScope(vble)
@@ -3895,7 +3894,7 @@ trait Typers extends Modes {
def subArrayType(pt: Type) =
if (isValueClass(pt.typeSymbol) || !isFullyDefined(pt)) arrayType(pt)
else {
- val tparam = context.owner freshExistential "" setInfo TypeBounds(NothingClass.tpe, pt)
+ val tparam = context.owner freshExistential "" setInfo TypeBounds.upper(pt)
ExistentialType(List(tparam), arrayType(tparam.tpe))
}
val (expr1, baseClass) = expr0.tpe.typeSymbol match {