diff options
author | Paul Phillips <paulp@improving.org> | 2011-01-07 19:07:01 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-01-07 19:07:01 +0000 |
commit | 32e7c243272d7aaae6c662aa3e1716dae61e1117 (patch) | |
tree | ec61af7fab062994641da341d5aea4c8aaf67fa3 /test/files | |
parent | 148736c3df1fa6463b4b2658c01bcf452a52c224 (diff) | |
download | scala-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 'test/files')
-rw-r--r-- | test/files/run/bug2512.scala | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/test/files/run/bug2512.scala b/test/files/run/bug2512.scala index 514b26650f..8166839a9a 100644 --- a/test/files/run/bug2512.scala +++ b/test/files/run/bug2512.scala @@ -1,12 +1,11 @@ import scala.tools.nsc.util.HashSet -object Test -{ +object Test { val runs = 10000 class Bop def main(args: Array[String]): Unit = { - val set: HashSet[Bop] = new HashSet("Bop", 16) + val set: HashSet[Bop] = HashSet("Bop", 16) (1 to runs).toList foreach (_ => set addEntry new Bop) assert(runs == set.size && set.size == set.iterator.length) |