summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-11-18 23:24:23 +0000
committerPaul Phillips <paulp@improving.org>2009-11-18 23:24:23 +0000
commit2a6a02e9a782b7621e3dc79d2f07fca074b11bb6 (patch)
tree54a5c40bcd7bdb8895dd35bf66da62007b51fa94 /src
parentd92679d81c8674e2e21cc18103d10ab16a3b8e0d (diff)
downloadscala-2a6a02e9a782b7621e3dc79d2f07fca074b11bb6.tar.gz
scala-2a6a02e9a782b7621e3dc79d2f07fca074b11bb6.tar.bz2
scala-2a6a02e9a782b7621e3dc79d2f07fca074b11bb6.zip
More deprecation soothing.
warning count.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/PhaseAssembly.scala178
-rw-r--r--src/compiler/scala/tools/nsc/Settings.scala3
-rw-r--r--src/compiler/scala/tools/nsc/ast/Trees.scala19
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala5
-rw-r--r--src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala2
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/Completion.scala2
-rw-r--r--src/compiler/scala/tools/nsc/models/Signatures.scala10
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala10
-rw-r--r--src/compiler/scala/tools/nsc/transform/Mixin.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala2
-rw-r--r--src/compiler/scala/tools/nsc/util/TreeSet.scala8
-rw-r--r--src/library/scala/Enumeration.scala2
-rw-r--r--src/library/scala/collection/immutable/List.scala8
-rw-r--r--src/library/scala/reflect/Print.scala2
-rw-r--r--src/library/scala/runtime/ScalaRunTime.scala2
-rw-r--r--src/library/scala/util/Random.scala2
-rw-r--r--src/library/scala/xml/NamespaceBinding.scala2
-rw-r--r--src/library/scala/xml/TopScope.scala1
-rw-r--r--src/scalap/scala/tools/scalap/scalax/rules/scalasig/ClassFileParser.scala2
-rw-r--r--src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala2
22 files changed, 134 insertions, 134 deletions
diff --git a/src/compiler/scala/tools/nsc/PhaseAssembly.scala b/src/compiler/scala/tools/nsc/PhaseAssembly.scala
index 918b56fcfb..958bef5652 100644
--- a/src/compiler/scala/tools/nsc/PhaseAssembly.scala
+++ b/src/compiler/scala/tools/nsc/PhaseAssembly.scala
@@ -42,8 +42,8 @@ trait PhaseAssembly { self: Global =>
var level = 0
def allPhaseNames(): String = phaseobj match {
- case None => phasename
- case Some(lst) => lst.map(_.phaseName).reduceLeft(_+","+_)
+ case None => phasename
+ case Some(lst) => lst.map(_.phaseName).reduceLeft(_+","+_)
}
}
@@ -56,9 +56,9 @@ trait PhaseAssembly { self: Global =>
def getNodeByPhase(phs: SubComponent): Node = {
var node: Node = getNodeByPhase(phs.phaseName)
node.phaseobj match {
- case None =>
- node.phaseobj = Some(List[SubComponent](phs))
- case _ =>
+ case None =>
+ node.phaseobj = Some(List[SubComponent](phs))
+ case _ =>
}
node
}
@@ -107,12 +107,12 @@ trait PhaseAssembly { self: Global =>
var lvl = 1
var nds = nodes.valuesIterator.filter(_.level == lvl).toList
while(nds.size > 0) {
- nds = nds.sort((n1,n2) => (n1.phasename compareTo n2.phasename) < 0)
- for (n <- nds) {
- chain = chain ::: n.phaseobj.get
- }
- lvl += 1
- nds = nodes.valuesIterator.filter(_.level == lvl).toList
+ nds = nds.sortWith((n1,n2) => (n1.phasename compareTo n2.phasename) < 0)
+ for (n <- nds) {
+ chain = chain ::: n.phaseobj.get
+ }
+ lvl += 1
+ nds = nodes.valuesIterator.filter(_.level == lvl).toList
}
chain
}
@@ -122,7 +122,7 @@ trait PhaseAssembly { self: Global =>
*/
def collapseHardLinksAndLevels(node: Node, lvl: Int) {
if (node.visited) {
- throw new FatalError(
+ throw new FatalError(
"Cycle in compiler phase dependencies detected, phase " +
node.phasename + " reacted twice!")
}
@@ -131,19 +131,19 @@ trait PhaseAssembly { self: Global =>
var hls = Nil ++ node.before.filter(_.hard)
while (hls.size > 0) {
- for (hl <- hls) {
- node.phaseobj = Some(node.phaseobj.get ++ hl.frm.phaseobj.get)
- node.before = hl.frm.before
- nodes -= hl.frm.phasename
- edges -= hl
- for (edge <- node.before) edge.to = node
- }
- hls = Nil ++ node.before.filter(_.hard)
+ for (hl <- hls) {
+ node.phaseobj = Some(node.phaseobj.get ++ hl.frm.phaseobj.get)
+ node.before = hl.frm.before
+ nodes -= hl.frm.phasename
+ edges -= hl
+ for (edge <- node.before) edge.to = node
+ }
+ hls = Nil ++ node.before.filter(_.hard)
}
node.visited = true
for (edge <- node.before) {
- collapseHardLinksAndLevels( edge.frm, lvl + 1)
+ collapseHardLinksAndLevels( edge.frm, lvl + 1)
}
node.visited = false
@@ -156,44 +156,44 @@ trait PhaseAssembly { self: Global =>
def validateAndEnforceHardlinks() {
var hardlinks = edges.filter(_.hard)
for (hl <- hardlinks) {
- if (hl.frm.after.size > 1) {
- throw new FatalError("phase " + hl.frm.phasename + " want to run right after " + hl.to.phasename + ", but some phase has declared to run before " + hl.frm.phasename + ". Re-run with -Xgenerate-phase-graph <filename> to better see the problem.")
- }
+ if (hl.frm.after.size > 1) {
+ throw new FatalError("phase " + hl.frm.phasename + " want to run right after " + hl.to.phasename + ", but some phase has declared to run before " + hl.frm.phasename + ". Re-run with -Xgenerate-phase-graph <filename> to better see the problem.")
+ }
}
var rerun = true
while (rerun) {
- rerun = false
- hardlinks = edges.filter(_.hard)
- for (hl <- hardlinks) {
- var sanity = Nil ++ hl.to.before.filter(_.hard)
- if (sanity.length == 0) {
- throw new FatalError("There is no runs right after dependency, where there should be one! This is not supposed to happen!")
- } else if (sanity.length > 1) {
- var msg = "Multiple phases want to run right after the phase " + sanity.head.to.phasename + "\n"
- msg += "Phases: "
- sanity = sanity.sort((e1,e2) => (e1.frm.phasename compareTo e2.frm.phasename) < 0)
- for (edge <- sanity) {
- msg += edge.frm.phasename + ", "
- }
- msg += "\nRe-run with -Xgenerate-phase-graph <filename> to better see the problem."
- throw new FatalError(msg)
-
- } else {
-
- var promote = hl.to.before.filter(e => (!e.hard))
- hl.to.before.clear
- sanity foreach (edge => hl.to.before += edge)
- for (edge <- promote) {
- rerun = true
- informProgress(
+ rerun = false
+ hardlinks = edges.filter(_.hard)
+ for (hl <- hardlinks) {
+ var sanity = Nil ++ hl.to.before.filter(_.hard)
+ if (sanity.length == 0) {
+ throw new FatalError("There is no runs right after dependency, where there should be one! This is not supposed to happen!")
+ } else if (sanity.length > 1) {
+ var msg = "Multiple phases want to run right after the phase " + sanity.head.to.phasename + "\n"
+ msg += "Phases: "
+ sanity = sanity.sortWith((e1,e2) => (e1.frm.phasename compareTo e2.frm.phasename) < 0)
+ for (edge <- sanity) {
+ msg += edge.frm.phasename + ", "
+ }
+ msg += "\nRe-run with -Xgenerate-phase-graph <filename> to better see the problem."
+ throw new FatalError(msg)
+
+ } else {
+
+ var promote = hl.to.before.filter(e => (!e.hard))
+ hl.to.before.clear
+ sanity foreach (edge => hl.to.before += edge)
+ for (edge <- promote) {
+ rerun = true
+ informProgress(
"promote the dependency of " + edge.frm.phasename +
": " + edge.to.phasename + " => " + hl.frm.phasename)
- edge.to = hl.frm
- hl.frm.before += edge
- }
- }
- }
+ edge.to = hl.frm
+ hl.frm.before += edge
+ }
+ }
+ }
}
}
@@ -205,17 +205,17 @@ trait PhaseAssembly { self: Global =>
def removeDanglingNodes() {
var dnodes = nodes.valuesIterator filter (_.phaseobj.isEmpty)
for (node <- dnodes) {
- val msg = "dropping dependency on node with no phase object: "+node.phasename
+ val msg = "dropping dependency on node with no phase object: "+node.phasename
informProgress(msg)
- nodes -= node.phasename
- for (edge <- node.before) {
- edges -= edge
- edge.frm.after -= edge
- edge.frm.phaseobj match {
- case Some(lsc) => if (! lsc.head.internal) warning(msg)
- case _ =>
- }
- }
+ nodes -= node.phasename
+ for (edge <- node.before) {
+ edges -= edge
+ edge.frm.after -= edge
+ edge.frm.phaseobj match {
+ case Some(lsc) => if (! lsc.head.internal) warning(msg)
+ case _ =>
+ }
+ }
}
}
@@ -268,30 +268,30 @@ trait PhaseAssembly { self: Global =>
var fromnode = graph.getNodeByPhase(phs)
phs.runsRightAfter match {
- case None =>
- for (phsname <- phs.runsAfter) {
- if (phsname != "terminal") {
- val tonode = graph.getNodeByPhase(phsname)
- graph.softConnectNodes(fromnode, tonode)
- } else {
- error("[phase assembly, after dependency on terminal phase not allowed: " + fromnode.phasename + " => "+ phsname + "]")
- }
- }
- for (phsname <- phs.runsBefore) {
- if (phsname != "parser") {
- val tonode = graph.getNodeByPhase(phsname)
- graph.softConnectNodes(tonode, fromnode)
- } else {
- error("[phase assembly, before dependency on parser phase not allowed: " + phsname + " => "+ fromnode.phasename + "]")
- }
- }
- case Some(phsname) =>
- if (phsname != "terminal") {
- val tonode = graph.getNodeByPhase(phsname)
+ case None =>
+ for (phsname <- phs.runsAfter) {
+ if (phsname != "terminal") {
+ val tonode = graph.getNodeByPhase(phsname)
+ graph.softConnectNodes(fromnode, tonode)
+ } else {
+ error("[phase assembly, after dependency on terminal phase not allowed: " + fromnode.phasename + " => "+ phsname + "]")
+ }
+ }
+ for (phsname <- phs.runsBefore) {
+ if (phsname != "parser") {
+ val tonode = graph.getNodeByPhase(phsname)
+ graph.softConnectNodes(tonode, fromnode)
+ } else {
+ error("[phase assembly, before dependency on parser phase not allowed: " + phsname + " => "+ fromnode.phasename + "]")
+ }
+ }
+ case Some(phsname) =>
+ if (phsname != "terminal") {
+ val tonode = graph.getNodeByPhase(phsname)
graph.hardConnectNodes(fromnode, tonode)
- } else {
- error("[phase assembly, right after dependency on terminal phase not allowed: " + fromnode.phasename + " => "+ phsname + "]")
- }
+ } else {
+ error("[phase assembly, right after dependency on terminal phase not allowed: " + fromnode.phasename + " => "+ phsname + "]")
+ }
}
}
graph
@@ -309,14 +309,14 @@ trait PhaseAssembly { self: Global =>
for (edge <- graph.edges) {
sbuf.append("\"" + edge.frm.allPhaseNames + "(" + edge.frm.level + ")" + "\"->\"" + edge.to.allPhaseNames + "(" + edge.to.level + ")" + "\"")
if (! edge.frm.phaseobj.get.head.internal) {
- extnodes += edge.frm
+ extnodes += edge.frm
}
edge.frm.phaseobj match { case None => null case Some(ln) => if(ln.size > 1) fatnodes += edge.frm }
edge.to.phaseobj match { case None => null case Some(ln) => if(ln.size > 1) fatnodes += edge.to }
if (edge.hard) {
- sbuf.append(" [color=\"#0000ff\"]\n")
+ sbuf.append(" [color=\"#0000ff\"]\n")
} else {
- sbuf.append(" [color=\"#000000\"]\n")
+ sbuf.append(" [color=\"#000000\"]\n")
}
}
for (node <- extnodes) {
diff --git a/src/compiler/scala/tools/nsc/Settings.scala b/src/compiler/scala/tools/nsc/Settings.scala
index 314b575f1e..50ef58232b 100644
--- a/src/compiler/scala/tools/nsc/Settings.scala
+++ b/src/compiler/scala/tools/nsc/Settings.scala
@@ -426,7 +426,8 @@ object Settings {
// Ordered (so we can use TreeSet)
def compare(that: Setting): Int = name compare that.name
- def compareLists[T <% Ordered[T]](xs: List[T], ys: List[T]): Boolean = xs.sort(_ < _) == ys.sort(_ < _)
+ def compareLists[T <% Ordered[T]](xs: List[T], ys: List[T]): Boolean =
+ xs.sortWith(_ < _) == ys.sortWith(_ < _)
// Equality
def eqValues: List[Any] = List(name, value)
diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala
index 435713d82c..373859b836 100644
--- a/src/compiler/scala/tools/nsc/ast/Trees.scala
+++ b/src/compiler/scala/tools/nsc/ast/Trees.scala
@@ -630,16 +630,15 @@ trait Trees {
}})
val (edefs, rest) = body span treeInfo.isEarlyDef
val (evdefs, etdefs) = edefs partition treeInfo.isEarlyValDef
- val (lvdefs, gvdefs) =
- evdefs map {
- case vdef @ ValDef(mods, name, tpt, rhs) =>
- val fld = treeCopy.ValDef(
- vdef.duplicate, mods, name,
- atPos(vdef.pos.focus) { TypeTree() setOriginal tpt setPos tpt.pos.focus }, // atPos in case
- EmptyTree)
- val local = treeCopy.ValDef(vdef, Modifiers(PRESUPER), name, tpt, rhs)
- (local, fld)
- } unzip
+ val (lvdefs, gvdefs) = evdefs map {
+ case vdef @ ValDef(mods, name, tpt, rhs) =>
+ val fld = treeCopy.ValDef(
+ vdef.duplicate, mods, name,
+ atPos(vdef.pos.focus) { TypeTree() setOriginal tpt setPos tpt.pos.focus }, // atPos in case
+ EmptyTree)
+ val local = treeCopy.ValDef(vdef, Modifiers(PRESUPER), name, tpt, rhs)
+ (local, fld)
+ } unzip
val constrs = {
if (constrMods.isTrait) {
diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
index 29a9599744..da864ef706 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
@@ -378,7 +378,7 @@ abstract class TreeBuilder {
val rhss = valeqs map { case ValEq(_, _, rhs) => rhs }
val defpat1 = makeBind(pat)
val defpats = pats map makeBind
- val pdefs = (List.map2(defpats, rhss)(makePatDef)).flatten
+ val pdefs = (defpats, rhss).zipped flatMap makePatDef
val ids = (defpat1 :: defpats) map makeValue
val rhs1 = makeForYield(
List(ValFrom(pos, defpat1, rhs)),
diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala
index 048c44c467..f33d7fae39 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/CopyPropagation.scala
@@ -188,7 +188,7 @@ abstract class CopyPropagation {
else {
// if (a.stack.length != b.stack.length)
// throw new LubError(a, b, "Invalid stacks in states: ");
- List.map2(a.stack, b.stack) { (v1, v2) =>
+ (a.stack, b.stack).zipped map { (v1, v2) =>
if (v1 == v2) v1 else Unknown
}
}
diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
index bbc11037ce..8e794f4787 100644
--- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
+++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
@@ -981,7 +981,7 @@ abstract class GenMSIL extends SubComponent {
})
// shorter try-catch-finally last (the ones contained in another)
- affectedHandlers = affectedHandlers.sort({(h1, h2) => h1.covered.size > h2.covered.size})
+ affectedHandlers = affectedHandlers.sortWith(_.covered.size > _.covered.size)
affectedHandlers = affectedHandlers.filter(h => {h.covered.size == affectedHandlers(0).covered.size})
untreatedHandlers = untreatedHandlers -- affectedHandlers
@@ -1133,10 +1133,9 @@ abstract class GenMSIL extends SubComponent {
// take care of order in which exHInstructions are executed (BeginExceptionBlock as last)
bb2exHInstructions.keysIterator.foreach((b) => {
- bb2exHInstructions(b).sort((i1, i2) => (!i1.isInstanceOf[BeginExceptionBlock]))
+ bb2exHInstructions(b).sortBy(x => x.isInstanceOf[BeginExceptionBlock])
})
-
if (settings.debug.value) {
log("after: " + orderedBlocks)
log(" exhInstr: " + bb2exHInstructions)
diff --git a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala
index fdc2fd3a24..05d384cda2 100644
--- a/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala
+++ b/src/compiler/scala/tools/nsc/interactive/RefinedBuildManager.scala
@@ -118,7 +118,7 @@ class RefinedBuildManager(val settings: Settings) extends Changes with BuildMana
}
}
// Create a change for the top level classes that were removed
- val removed = definitions(src) remove ((s: Symbol) =>
+ val removed = definitions(src) filterNot ((s: Symbol) =>
syms.find(_.fullNameString == s.fullNameString) match {
case None => false
case _ => true
diff --git a/src/compiler/scala/tools/nsc/interpreter/Completion.scala b/src/compiler/scala/tools/nsc/interpreter/Completion.scala
index fed2a6c5c1..7c8c6e6ef4 100644
--- a/src/compiler/scala/tools/nsc/interpreter/Completion.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/Completion.scala
@@ -62,7 +62,7 @@ class Completion(val interpreter: Interpreter) extends Completor {
def filt(xs: List[String]) = xs filter (_ startsWith stub)
case class Result(candidates: List[String], position: Int) {
- def getCandidates() = (candidates map (_.trim) removeDuplicates) sort (_ < _)
+ def getCandidates() = (candidates map (_.trim) removeDuplicates) sortWith (_ < _)
}
// work out completion candidates and position
diff --git a/src/compiler/scala/tools/nsc/models/Signatures.scala b/src/compiler/scala/tools/nsc/models/Signatures.scala
index 98bfa142ff..0d75cf7101 100644
--- a/src/compiler/scala/tools/nsc/models/Signatures.scala
+++ b/src/compiler/scala/tools/nsc/models/Signatures.scala
@@ -25,14 +25,10 @@ class Signatures(val compiler: Compiler) {
def asString: String = name + "[" + asString0(children) + "]"
}
- def sort(sigs: List[Signature]) =
- sigs.sort((l0,l1) => l0.name.compareTo(l1.name) > 0)
+ def sort(sigs: List[Signature]) = sigs sortBy (_.name) reverse
- def asString0(sigs: List[Signature]): String = {
- var ret = ""
- for (sig <- sort(sigs)) ret = ret + sig.asString
- ret
- }
+ def asString0(sigs: List[Signature]): String =
+ sort(sigs) map (_.asString) mkString
def signature(unit: CompilationUnit): String =
asString0(signature(unit.body, Nil))
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index a68f766c9c..3171a13454 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -3663,7 +3663,7 @@ A type's typeSymbol should never be inspected directly.
case (TypeRef(pre1, sym1, args1), TypeRef(pre2, sym2, args2)) =>
assert(sym1 == sym2)
pre1 =:= pre2 &&
- !(List.map3(args1, args2, sym1.typeParams) {
+ ((args1, args2, sym1.typeParams).zipped forall {
(arg1, arg2, tparam) =>
//if (tparam.variance == 0 && !(arg1 =:= arg2)) Console.println("inconsistent: "+arg1+"!="+arg2)//DEBUG
if (tparam.variance == 0) arg1 =:= arg2
@@ -3674,7 +3674,7 @@ A type's typeSymbol should never be inspected directly.
// also: think what happens if there are embedded typevars?
if (tparam.variance < 0) arg1 <:< arg2 else arg2 <:< arg1
else true
- } contains false)
+ })
case (et: ExistentialType, _) =>
et.withTypeVars(isConsistent(_, tp2))
case (_, et: ExistentialType) =>
@@ -4514,7 +4514,7 @@ A type's typeSymbol should never be inspected directly.
case List(t) => t
case ts @ PolyType(tparams, _) :: _ =>
PolyType(
- List.map2(tparams, List.transpose(matchingBounds(ts, tparams)))
+ List.map2(tparams, matchingBounds(ts, tparams).transpose)
((tparam, bounds) => tparam.cloneSymbol.setInfo(glb(bounds, depth))),
lub0(matchingInstTypes(ts, tparams)))
case ts @ MethodType(params, _) :: rest =>
@@ -4615,7 +4615,7 @@ A type's typeSymbol should never be inspected directly.
case List(t) => t
case ts @ PolyType(tparams, _) :: _ =>
PolyType(
- List.map2(tparams, List.transpose(matchingBounds(ts, tparams)))
+ List.map2(tparams, matchingBounds(ts, tparams).transpose)
((tparam, bounds) => tparam.cloneSymbol.setInfo(lub(bounds, depth))),
glb0(matchingInstTypes(ts, tparams)))
case ts @ MethodType(params, _) :: rest =>
@@ -4738,7 +4738,7 @@ A type's typeSymbol should never be inspected directly.
val pre = if (variance == 1) lub(pres, depth) else glb(pres, depth)
val argss = tps map (_.typeArgs)
val capturedParams = new ListBuffer[Symbol]
- val args = List.map2(sym.typeParams, List.transpose(argss)) {
+ val args = (sym.typeParams, argss.transpose).zipped map {
(tparam, as) =>
if (depth == 0)
if (tparam.variance == variance) AnyClass.tpe
diff --git a/src/compiler/scala/tools/nsc/transform/Mixin.scala b/src/compiler/scala/tools/nsc/transform/Mixin.scala
index 0daad7f2a7..fa436a4305 100644
--- a/src/compiler/scala/tools/nsc/transform/Mixin.scala
+++ b/src/compiler/scala/tools/nsc/transform/Mixin.scala
@@ -671,7 +671,7 @@ abstract class Mixin extends InfoTransform with ast.TreeDSL {
val bitmapSym = bitmapFor(clazz, offset)
val mask = LIT(1 << (offset % FLAGS_PER_WORD))
def cond = mkTest(clazz, mask, bitmapSym, true)
- val nulls = (lazyValNullables(lzyVal).toList.sort(_.id < _.id) map nullify)
+ val nulls = (lazyValNullables(lzyVal).toList sortBy (_.id) map nullify)
def syncBody = init ::: List(mkSetFlag(clazz, offset), UNIT)
log("nulling fields inside " + lzyVal + ": " + nulls)
diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
index a3f628ebb4..d6e6afdac0 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
@@ -182,7 +182,7 @@ trait SyntheticMethods extends ast.TreeDSL {
}
// Creates list of parameters and a guard for each
- val (guards, params) = List.map2(clazz.caseFieldAccessors, constrParamTypes)(makeTrees) unzip
+ val (guards, params) = (clazz.caseFieldAccessors, constrParamTypes).zipped map makeTrees unzip
// Verify with canEqual method before returning true.
def canEqualCheck() = {
diff --git a/src/compiler/scala/tools/nsc/util/TreeSet.scala b/src/compiler/scala/tools/nsc/util/TreeSet.scala
index 1862212467..4a84517eb1 100644
--- a/src/compiler/scala/tools/nsc/util/TreeSet.scala
+++ b/src/compiler/scala/tools/nsc/util/TreeSet.scala
@@ -44,10 +44,14 @@ class TreeSet[T >: Null <: AnyRef](less: (T, T) => Boolean) extends Set[T] {
def iterator = {
def elems(t: Tree): Iterator[T] = {
var it = Iterator single t.elem
+ // XXX cannot replace these with ++ as the deprecation message says,
+ // else after locker builds it fails to build quick with stack overflow:
+ // [scalacfork] at scala.collection.Iterator$$anon$6.cur(Iterator.scala:321)
+ // [scalacfork] at scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:322)
+ // [scalacfork] at scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:322)
+ // [scalacfork] at scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:322)
if (t.l ne null) it = elems(t.l) append it
if (t.r ne null) it = it append elems(t.r)
- // if (t.l ne null) it = elems(t.l) ++ it
- // if (t.r ne null) it = it ++ elems(t.r)
it
}
if (tree eq null) Iterator.empty else elems(tree)
diff --git a/src/library/scala/Enumeration.scala b/src/library/scala/Enumeration.scala
index 01f99d550a..86e0dbe708 100644
--- a/src/library/scala/Enumeration.scala
+++ b/src/library/scala/Enumeration.scala
@@ -176,7 +176,7 @@ abstract class Enumeration(initial: Int, names: String*) {
val value = m.invoke(this)
// invoke `id` method
val idMeth = classOf[Val].getMethod("id")
- val id: Int = idMeth.invoke(value).asInstanceOf[Integer].intValue()
+ val id: Int = idMeth.invoke(value).asInstanceOf[java.lang.Integer].intValue()
nmap += (id -> name)
}
nmap(i)
diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala
index d60ea0f58b..8c43bdb998 100644
--- a/src/library/scala/collection/immutable/List.scala
+++ b/src/library/scala/collection/immutable/List.scala
@@ -653,7 +653,7 @@ object List extends SeqFactory[List] {
* <code>[a0, ..., ak]</code>, <code>[b0, ..., bl]</code> and
* <code>n = min(k,l)</code>
*/
- @deprecated("use `(xs, ys).map(f)' instead")
+ @deprecated("use `(xs, ys).zipped.map(f)' instead")
def map2[A,B,C](xs: List[A], ys: List[B])(f: (A, B) => C): List[C] = {
val b = new ListBuffer[C]
var xc = xs
@@ -677,7 +677,7 @@ object List extends SeqFactory[List] {
* <code>[c<sub>0</sub>, ..., c<sub>m</sub>]</code> and
* <code>n = min(k,l,m)</code>
*/
- @deprecated("use `(xs, ys, zs).map(f)' instead")
+ @deprecated("use `(xs, ys, zs).zipped.map(f)' instead")
def map3[A,B,C,D](xs: List[A], ys: List[B], zs: List[C])(f: (A, B, C) => D): List[D] = {
val b = new ListBuffer[D]
var xc = xs
@@ -702,7 +702,7 @@ object List extends SeqFactory[List] {
* <code>[b<sub>0</sub>, ..., b<sub>l</sub>]</code>
* and <code>n = min(k,l)</code>
*/
- @deprecated("use `(xs, ys).forall(f)' instead")
+ @deprecated("use `(xs, ys).zipped.forall(f)' instead")
def forall2[A,B](xs: List[A], ys: List[B])(f: (A, B) => Boolean): Boolean = {
var xc = xs
var yc = ys
@@ -724,7 +724,7 @@ object List extends SeqFactory[List] {
* <code>[b<sub>0</sub>, ..., b<sub>l</sub>]</code> and
* <code>n = min(k,l)</code>
*/
- @deprecated("use `(xs, ys).exists(f)' instead")
+ @deprecated("use `(xs, ys).zipped.exists(f)' instead")
def exists2[A,B](xs: List[A], ys: List[B])(f: (A, B) => Boolean): Boolean = {
var xc = xs
var yc = ys
diff --git a/src/library/scala/reflect/Print.scala b/src/library/scala/reflect/Print.scala
index 6df7fb032a..ab9ffdc99b 100644
--- a/src/library/scala/reflect/Print.scala
+++ b/src/library/scala/reflect/Print.scala
@@ -106,6 +106,8 @@ object Print extends Function1[Any, String] {
(List.map2(typeParams, typeBounds)
((tp, tb) => "[" + Print(tb._1) + " :> " + Print(tp) + " :> " + Print(tb._2) + "]")).
mkString("[", ", ", "]") + " -> " + Print(resultType)
+ // val z = (typeParams, typeBounds).zip map { case (tp, tb) => "[" + Print(tb._1) + " :> " + Print(tp) + " :> " + Print(tb._2) + "]" }
+ // z.mkString("[", ", ", "]") + " -> " + Print(resultType)
case _ =>
"???"
}
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala
index 6467751a1f..c25e042957 100644
--- a/src/library/scala/runtime/ScalaRunTime.scala
+++ b/src/library/scala/runtime/ScalaRunTime.scala
@@ -125,7 +125,7 @@ object ScalaRunTime {
@inline def inlinedEquals(x: Object, y: Object): Boolean =
if (x eq y) true
else if (x eq null) false
- else if (x.isInstanceOf[Number] || x.isInstanceOf[Character]) BoxesRunTime.equals2(x, y)
+ else if (x.isInstanceOf[java.lang.Number] || x.isInstanceOf[java.lang.Character]) BoxesRunTime.equals2(x, y)
else x.equals(y)
def _equals(x: Product, y: Any): Boolean = y match {
diff --git a/src/library/scala/util/Random.scala b/src/library/scala/util/Random.scala
index d1c04e996f..4a61377eea 100644
--- a/src/library/scala/util/Random.scala
+++ b/src/library/scala/util/Random.scala
@@ -119,7 +119,7 @@ object Random extends Random
* @return the shuffled Traversable
*/
def shuffle[T, CC[X] <: Traversable[X]](coll: CC[T])(implicit bf: CanBuildFrom[CC[T], T, CC[T]]): CC[T] = {
- val buf = new ArrayBuffer[T] ++ coll
+ val buf = new ArrayBuffer[T] ++= coll
def swap(i1: Int, i2: Int) {
val tmp = buf(i1)
diff --git a/src/library/scala/xml/NamespaceBinding.scala b/src/library/scala/xml/NamespaceBinding.scala
index 93485a17fe..8adda4197a 100644
--- a/src/library/scala/xml/NamespaceBinding.scala
+++ b/src/library/scala/xml/NamespaceBinding.scala
@@ -25,7 +25,7 @@ import collection.mutable.StringBuilder
@SerialVersionUID(0 - 2518644165573446725L)
case class NamespaceBinding(prefix: String, uri: String, parent: NamespaceBinding) extends AnyRef
{
- if (prefix != null && prefix.isEmpty)
+ if (prefix == "")
throw new IllegalArgumentException("zero length prefix not allowed")
def getURI(_prefix: String): String =
diff --git a/src/library/scala/xml/TopScope.scala b/src/library/scala/xml/TopScope.scala
index c458248ae3..41a1678a50 100644
--- a/src/library/scala/xml/TopScope.scala
+++ b/src/library/scala/xml/TopScope.scala
@@ -12,7 +12,6 @@ package scala.xml
import collection.mutable.StringBuilder
-
/** top level namespace scope. only contains the predefined binding
* for the &quot;xml&quot; prefix which is bound to
* &quot;http://www.w3.org/XML/1998/namespace&quot;
diff --git a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ClassFileParser.scala b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ClassFileParser.scala
index 182054c01b..bc47092f71 100644
--- a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ClassFileParser.scala
+++ b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ClassFileParser.scala
@@ -217,7 +217,7 @@ case class ConstantPool(len : Int) {
}
def add(f : ConstantPool => Any) = {
- buffer + f
+ buffer += f
this
}
}
diff --git a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala
index 906b44e4ae..733df3adcd 100644
--- a/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala
+++ b/src/scalap/scala/tools/scalap/scalax/rules/scalasig/ScalaSigPrinter.scala
@@ -357,7 +357,7 @@ class ScalaSigPrinter(stream: PrintStream, printPrivates: Boolean) {
"\\$times" -> "*", "\\$div" -> "/", "\\$bslash" -> "\\\\",
"\\$greater" -> ">", "\\$qmark" -> "?", "\\$percent" -> "%",
"\\$amp" -> "&", "\\$colon" -> ":", "\\$u2192" -> "→")
- val pattern = Pattern.compile(_syms.keys.foldLeft("")((x, y) => if (x == "") y else x + "|" + y))
+ val pattern = Pattern.compile(_syms.keysIterator.foldLeft("")((x, y) => if (x == "") y else x + "|" + y))
val placeholderPattern = "_\\$(\\d)+"
def processName(name: String) = {