summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-02-03 17:34:31 +0000
committerPaul Phillips <paulp@improving.org>2010-02-03 17:34:31 +0000
commit96a42a2eda85489bb7dba25d9e8597bd35d7bcbd (patch)
tree51e3848b5d994cdaee75c9faefead41bc9e729d0 /src/compiler
parenta6eecfb04532c83a715d520e885250e8de808f9e (diff)
downloadscala-96a42a2eda85489bb7dba25d9e8597bd35d7bcbd.tar.gz
scala-96a42a2eda85489bb7dba25d9e8597bd35d7bcbd.tar.bz2
scala-96a42a2eda85489bb7dba25d9e8597bd35d7bcbd.zip
Striking while the iron is hot, renamed removeD...
Striking while the iron is hot, renamed removeDuplicates to unique and deprecated removeDuplicates. The debate between distinct and unique was vigorous but unique won by a freckle. (Dark horse 'nub' was disqualified for taking performance enhancers.) The only thing which might need review is the choice of name, but review by odersky.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala2
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala2
-rw-r--r--src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala2
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/PackageCompletion.scala4
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala2
11 files changed, 14 insertions, 14 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 9b77890486..8a20a5e1f2 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -736,7 +736,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
/** Compile list of source files */
def compileSources(_sources: List[SourceFile]) {
- val depSources = dependencyAnalysis.filter(_sources.removeDuplicates) // bug #1268, scalac confused by duplicated filenames
+ val depSources = dependencyAnalysis.filter(_sources.unique) // bug #1268, scalac confused by duplicated filenames
val sources = scalaObjectFirst(depSources)
if (reporter.hasErrors)
return // there is a problem already, e.g. a
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index 34a82b987b..1c792f0671 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -239,7 +239,7 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
private def keyList[T](x: collection.Map[T, _]): List[T] = x.keysIterator.toList sortBy (_.toString)
def allUsedNames = keyList(usedNameMap)
def allBoundNames = keyList(boundNameMap)
- def allSeenTypes = prevRequests.toList flatMap (_.typeOf.valuesIterator.toList) removeDuplicates
+ def allSeenTypes = prevRequests.toList flatMap (_.typeOf.valuesIterator.toList) unique
def allValueGeneratingNames = allHandlers flatMap (_.generatesValue)
def allImplicits = partialFlatMap(allHandlers) {
case x: MemberHandler if x.definesImplicit => x.boundNames
@@ -1129,7 +1129,7 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
} filterNot isSynthVarName
/** Another entry point for tab-completion, ids in scope */
- def unqualifiedIds() = (unqualifiedIdNames() map (_.toString)).removeDuplicates.sorted
+ def unqualifiedIds() = (unqualifiedIdNames() map (_.toString)).unique.sorted
/** For static/object method completion */
def getClassObject(path: String): Option[Class[_]] = classLoader tryToLoadClass path
diff --git a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
index 83342fb207..643860b2bc 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/BasicBlocks.scala
@@ -490,7 +490,7 @@ trait BasicBlocks {
ss ++ (ss flatMap findSucc)
}
- succs.flatMap(findSucc).removeDuplicates
+ succs flatMap findSucc unique
}
/** Returns the precessors of this block. */
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
index ec9c371534..b346c491ed 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -183,7 +183,7 @@ abstract class GenJVM extends SubComponent {
case _ => ()
}
- parents = parents.removeDuplicates
+ parents = parents.unique
if (parents.length > 1) {
ifaces = new Array[String](parents.length - 1)
@@ -332,7 +332,7 @@ abstract class GenJVM extends SubComponent {
// put some radom value; the actual number is determined at the end
buf.putShort(0xbaba.toShort)
- for (AnnotationInfo(tp, List(exc), _) <- excs.removeDuplicates if tp.typeSymbol == definitions.ThrowsClass) {
+ for (AnnotationInfo(tp, List(exc), _) <- excs.unique if tp.typeSymbol == definitions.ThrowsClass) {
val Literal(const) = exc
buf.putShort(
cpool.addClass(
diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
index 4f8bb63e74..4d323ec4d2 100644
--- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
+++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
@@ -1708,7 +1708,7 @@ abstract class GenMSIL extends SubComponent {
def isInterface(s: Symbol) = s.isTrait && !s.isImplClass
val parents: List[Type] =
if (sym.info.parents.isEmpty) List(definitions.ObjectClass.tpe)
- else sym.info.parents.removeDuplicates
+ else sym.info.parents.unique
val superType = if (isInterface(sym)) null else msilTypeFromSym(parents.head.typeSymbol)
if (settings.debug.value)
diff --git a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
index 00eea9b0f3..2841902e07 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
@@ -82,7 +82,7 @@ abstract class DeadCodeElimination extends SubComponent {
collectRDef(m)
mark
sweep(m)
- accessedLocals = accessedLocals.removeDuplicates
+ accessedLocals = accessedLocals.unique
if (m.locals diff accessedLocals nonEmpty) {
log("Removed dead locals: " + (m.locals diff accessedLocals))
m.locals = accessedLocals.reverse
diff --git a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala
index 10993b42fd..436c860b8c 100644
--- a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala
+++ b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala
@@ -158,7 +158,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana
atPhase(currentRun.erasurePhase.prev) {
changeSet(info, sym)
}
- changesOf(oldSym) = (changes ++ changesErasure).removeDuplicates
+ changesOf(oldSym) = (changes ++ changesErasure).unique
case _ =>
// a new top level definition
changesOf(sym) =
diff --git a/src/compiler/scala/tools/nsc/interpreter/PackageCompletion.scala b/src/compiler/scala/tools/nsc/interpreter/PackageCompletion.scala
index a0d83e1880..fb0dbcdded 100644
--- a/src/compiler/scala/tools/nsc/interpreter/PackageCompletion.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/PackageCompletion.scala
@@ -113,7 +113,7 @@ object PackageCompletion {
// all the dotted path to classfiles we can find by poking through the jars
def getDottedPaths(map: ConcurrentHashMap[String, List[CompletionInfo]], classpath: List[URL]): Unit = {
val cp = classpath map (_.getPath)
- val jars = cp.removeDuplicates filter (_ endsWith ".jar")
+ val jars = cp.unique filter (_ endsWith ".jar")
// for e.g. foo.bar.baz.C, returns (foo -> bar), (foo.bar -> baz), (foo.bar.baz -> C)
// and scala.Range$BigInt needs to go scala -> Range -> BigInt
@@ -137,7 +137,7 @@ object PackageCompletion {
def oneJar(jar: String): Unit = {
val classfiles = getClassFiles(jar)
- for (cl <- classfiles.removeDuplicates ; (k, _v) <- subpaths(cl)) {
+ for (cl <- classfiles.unique ; (k, _v) <- subpaths(cl)) {
val v = CompletionInfo(_v, cl, jar)
if (map containsKey k) {
diff --git a/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala b/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala
index 28ad2b7611..ee9dfc5b56 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ReflectionCompletion.scala
@@ -45,7 +45,7 @@ trait ReflectionCompletion extends CompletionAware {
val excludeMethods = List("hashCode", "equals", "wait", "notify", "notifyAll")
private def allInterfacesFor(cl: Class[_], acc: List[Class[_]]): List[Class[_]] = {
- if (cl == null) acc.removeDuplicates
+ if (cl == null) acc.unique
else allInterfacesFor(cl.getSuperclass, acc ::: cl.getInterfaces.toList)
}
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index e64a78e8e4..223eb6785c 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -727,7 +727,7 @@ trait Namers { self: Analyzer =>
}
if (!hasCopy(decls) &&
!parents.exists(p => hasCopy(p.typeSymbol.info.decls)) &&
- !parents.flatMap(_.baseClasses).removeDuplicates.exists(bc => hasCopy(bc.info.decls)))
+ !parents.flatMap(_.baseClasses).unique.exists(bc => hasCopy(bc.info.decls)))
addCopyMethod(cdef, templateNamer)
case None =>
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 5234bb44f1..4f414893f8 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -190,7 +190,7 @@ abstract class RefChecks extends InfoTransform {
case List(MixinOverrideError(_, msg)) =>
unit.error(clazz.pos, msg)
case MixinOverrideError(member, msg) :: others =>
- val others1 = others.map(_.member.name.decode).filter(member.name.decode != _).removeDuplicates
+ val others1 = others.map(_.member.name.decode).filter(member.name.decode != _).unique
unit.error(
clazz.pos,
msg+(if (others1.isEmpty) ""