diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-11-22 03:12:36 -0800 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-11-22 03:12:36 -0800 |
commit | 666f39d3493ee633a616c40f1c41add1190a3a40 (patch) | |
tree | a62015e39bfdd6235bdcf0bef31fc31342ea60b6 /src/compiler | |
parent | 42657a6918ef7d6fd3f36838739ec8a3b64744a3 (diff) | |
parent | b004c3ddb38f8e690a0895a51ad0c83ff57a01e7 (diff) | |
download | scala-666f39d3493ee633a616c40f1c41add1190a3a40.tar.gz scala-666f39d3493ee633a616c40f1c41add1190a3a40.tar.bz2 scala-666f39d3493ee633a616c40f1c41add1190a3a40.zip |
Merge pull request #3131 from densh/pr/deprecate-pair-and-triple
Deprecate Pair and Triple
Diffstat (limited to 'src/compiler')
11 files changed, 28 insertions, 28 deletions
diff --git a/src/compiler/scala/tools/ant/ScalaTool.scala b/src/compiler/scala/tools/ant/ScalaTool.scala index e7ac53c8fb..bb6a933d3f 100644 --- a/src/compiler/scala/tools/ant/ScalaTool.scala +++ b/src/compiler/scala/tools/ant/ScalaTool.scala @@ -139,7 +139,7 @@ class ScalaTool extends ScalaMatchingTask { val st = s.trim val stArray = st.split("=", 2) if (stArray.length == 2) { - if (input != "") List(Pair(stArray(0), stArray(1))) else Nil + if (input != "") List((stArray(0), stArray(1))) else Nil } else buildError("Property " + st + " is not formatted properly.") @@ -170,7 +170,7 @@ class ScalaTool extends ScalaMatchingTask { private def getProperties: String = properties.map({ - case Pair(name,value) => "-D" + name + "=\"" + value + "\"" + case (name,value) => "-D" + name + "=\"" + value + "\"" }).mkString("", " ", "") /*============================================================================*\ diff --git a/src/compiler/scala/tools/ant/sabbus/Compilers.scala b/src/compiler/scala/tools/ant/sabbus/Compilers.scala index b1994233e8..a0aad49f20 100644 --- a/src/compiler/scala/tools/ant/sabbus/Compilers.scala +++ b/src/compiler/scala/tools/ant/sabbus/Compilers.scala @@ -27,7 +27,7 @@ object Compilers extends scala.collection.DefaultMap[String, Compiler] { if (debug) println("Making compiler " + id) if (debug) println(" memory before: " + freeMemoryString) val comp = new Compiler(classpath, settings) - container += Pair(id, comp) + container(id) = comp if (debug) println(" memory after: " + freeMemoryString) comp } diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala index 60f7857d0c..939641c3eb 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala @@ -69,7 +69,7 @@ abstract class Liveness { case STORE_LOCAL(local) if (!genSet(local)) => killSet = killSet + local case _ => () } - Pair(genSet, killSet) + (genSet, killSet) } override def run() { diff --git a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala index 7a53293384..f10d7cdc40 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala @@ -418,7 +418,7 @@ abstract class TypeFlowAnalysis { !blackballed(concreteMethod) } if(isCandidate) { - remainingCALLs += Pair(cm, CallsiteInfo(b, receiver, result.stack.length, concreteMethod)) + remainingCALLs(cm) = CallsiteInfo(b, receiver, result.stack.length, concreteMethod) } else { remainingCALLs.remove(cm) isOnWatchlist.remove(cm) diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala index c166b0bb7e..4f9f4c9e31 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala @@ -741,13 +741,13 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder { var flatKeys: List[Int] = Nil var targets: List[asm.Label] = Nil var default: asm.Label = null - var switchBlocks: List[Pair[asm.Label, Tree]] = Nil + var switchBlocks: List[Tuple2[asm.Label, Tree]] = Nil // collect switch blocks and their keys, but don't emit yet any switch-block. for (caze @ CaseDef(pat, guard, body) <- tree.cases) { assert(guard == EmptyTree, guard) val switchBlockPoint = new asm.Label - switchBlocks ::= Pair(switchBlockPoint, body) + switchBlocks ::= (switchBlockPoint, body) pat match { case Literal(value) => flatKeys ::= value.intValue @@ -772,7 +772,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder { // emit switch-blocks. val postMatch = new asm.Label for (sb <- switchBlocks.reverse) { - val Pair(caseLabel, caseBody) = sb + val (caseLabel, caseBody) = sb markProgramPoint(caseLabel) genLoad(caseBody, generatedType) bc goTo postMatch @@ -790,7 +790,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder { genLoad(expr, expectedType) val end = currProgramPoint() if (emitVars) { // add entries to LocalVariableTable JVM attribute - for (Pair(sym, start) <- varsInScope.reverse) { emitLocalVarScope(sym, start, end) } + for ((sym, start) <- varsInScope.reverse) { emitLocalVarScope(sym, start, end) } } varsInScope = savedScope } diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala index c22ced26a5..64ed094a47 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala @@ -112,7 +112,7 @@ abstract class BCodeHelpers extends BCodeTypes with BytecodeWriters { val ta = exemplars.get(a) val tb = exemplars.get(b) - val res = Pair(ta.isInterface, tb.isInterface) match { + val res = (ta.isInterface, tb.isInterface) match { case (true, true) => // exercised by test/files/run/t4761.scala if (tb.isSubtypeOf(ta.c)) ta.c @@ -759,7 +759,7 @@ abstract class BCodeHelpers extends BCodeTypes with BytecodeWriters { def emitParamAnnotations(jmethod: asm.MethodVisitor, pannotss: List[List[AnnotationInfo]]) { val annotationss = pannotss map (_ filter shouldEmitAnnotation) if (annotationss forall (_.isEmpty)) return - for (Pair(annots, idx) <- annotationss.zipWithIndex; + for ((annots, idx) <- annotationss.zipWithIndex; annot <- annots) { val AnnotationInfo(typ, args, assocs) = annot assert(args.isEmpty, args) diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala index 5fe03624cf..c921d11d00 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala @@ -436,7 +436,7 @@ abstract class BCodeSkelBuilder extends BCodeHelpers { var labelDef: scala.collection.Map[Symbol, LabelDef] = null// (LabelDef-sym -> LabelDef) // bookkeeping the scopes of non-synthetic local vars, to emit debug info (`emitVars`). - var varsInScope: List[Pair[Symbol, asm.Label]] = null // (local-var-sym -> start-of-scope) + var varsInScope: List[Tuple2[Symbol, asm.Label]] = null // (local-var-sym -> start-of-scope) // helpers around program-points. def lastInsn: asm.tree.AbstractInsnNode = { diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala index 916d118b6e..5be5abd895 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala @@ -90,11 +90,11 @@ abstract class BCodeTypes extends BCodeIdiomatic { ) boxResultType = - for(Pair(csym, msym) <- currentRun.runDefinitions.boxMethod) + for((csym, msym) <- currentRun.runDefinitions.boxMethod) yield (msym -> classLiteral(primitiveTypeMap(csym))) unboxResultType = - for(Pair(csym, msym) <- currentRun.runDefinitions.unboxMethod) + for((csym, msym) <- currentRun.runDefinitions.unboxMethod) yield (msym -> primitiveTypeMap(csym)) // boxed classes are looked up in the `exemplars` map by jvmWiseLUB(). diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index 5e885fdd04..217d2b6835 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -335,7 +335,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { assert(a.isClass) assert(b.isClass) - val res = Pair(a.isInterface, b.isInterface) match { + val res = (a.isInterface, b.isInterface) match { case (true, true) => global.lub(List(a.tpe, b.tpe)).typeSymbol // TODO assert == firstCommonSuffix of resp. parents case (true, false) => @@ -1014,7 +1014,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { def emitParamAnnotations(jmethod: asm.MethodVisitor, pannotss: List[List[AnnotationInfo]]) { val annotationss = pannotss map (_ filter shouldEmitAnnotation) if (annotationss forall (_.isEmpty)) return - for (Pair(annots, idx) <- annotationss.zipWithIndex; + for ((annots, idx) <- annotationss.zipWithIndex; annot <- annots) { val AnnotationInfo(typ, args, assocs) = annot assert(args.isEmpty, args) @@ -2156,7 +2156,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { def getMerged(): scala.collection.Map[Local, List[Interval]] = { // TODO should but isn't: unbalanced start(s) of scope(s) - val shouldBeEmpty = pending filter { p => val Pair(_, st) = p; st.nonEmpty } + val shouldBeEmpty = pending filter { p => val (_, st) = p; st.nonEmpty } val merged = mutable.Map[Local, List[Interval]]() def addToMerged(lv: Local, start: Label, end: Label) { val intv = Interval(start, end) @@ -2169,7 +2169,7 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { (b) take the latest end (onePastLast if none available) (c) merge the thus made-up interval */ - for(Pair(k, st) <- shouldBeEmpty) { + for((k, st) <- shouldBeEmpty) { var start = st.toList.sortBy(_.getOffset).head if(merged.isDefinedAt(k)) { val balancedStart = merged(k).head.lstart @@ -2206,25 +2206,25 @@ abstract class GenASM extends SubComponent with BytecodeWriters with GenJVMASM { } // adding non-param locals var anonCounter = 0 - var fltnd: List[Triple[String, Local, Interval]] = Nil - for(Pair(local, ranges) <- scoping.getMerged()) { + var fltnd: List[Tuple3[String, Local, Interval]] = Nil + for((local, ranges) <- scoping.getMerged()) { var name = javaName(local.sym) if (name == null) { anonCounter += 1 name = "<anon" + anonCounter + ">" } for(intrvl <- ranges) { - fltnd ::= Triple(name, local, intrvl) + fltnd ::= (name, local, intrvl) } } // quest for deterministic output that Map.toList doesn't provide (so that ant test.stability doesn't complain). val srtd = fltnd.sortBy { kr => - val Triple(name: String, _, intrvl: Interval) = kr + val (name: String, _, intrvl: Interval) = kr - Triple(intrvl.start, intrvl.end - intrvl.start, name) // ie sort by (start, length, name) + (intrvl.start, intrvl.end - intrvl.start, name) // ie sort by (start, length, name) } - for(Triple(name, local, Interval(start, end)) <- srtd) { + for((name, local, Interval(start, end)) <- srtd) { jmethod.visitLocalVariable(name, descriptor(local.kind), null, start, end, indexOf(local)) } // "There may be no more than one LocalVariableTable attribute per local variable in the Code attribute" diff --git a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala index 0cfcea87f8..0f317422ac 100644 --- a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala +++ b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala @@ -119,7 +119,7 @@ abstract class DeadCodeElimination extends SubComponent { m foreachBlock { bb => useful(bb) = new mutable.BitSet(bb.size) var rd = rdef.in(bb) - for (Pair(i, idx) <- bb.toList.zipWithIndex) { + for ((i, idx) <- bb.toList.zipWithIndex) { // utility for adding to worklist def moveToWorkList() = moveToWorkListIf(cond = true) @@ -137,7 +137,7 @@ abstract class DeadCodeElimination extends SubComponent { i match { case LOAD_LOCAL(_) => - defs = defs + Pair(((bb, idx)), rd.vars) + defs = defs + (((bb, idx), rd.vars)) moveToWorkListIf(cond = false) case STORE_LOCAL(l) => @@ -350,7 +350,7 @@ abstract class DeadCodeElimination extends SubComponent { val oldInstr = bb.toList bb.open() bb.clear() - for (Pair(i, idx) <- oldInstr.zipWithIndex) { + for ((i, idx) <- oldInstr.zipWithIndex) { if (useful(bb)(idx)) { debuglog(" * " + i + " is useful") bb.emit(i, i.pos) diff --git a/src/compiler/scala/tools/nsc/plugins/Plugin.scala b/src/compiler/scala/tools/nsc/plugins/Plugin.scala index 1578caff26..d194c095f8 100644 --- a/src/compiler/scala/tools/nsc/plugins/Plugin.scala +++ b/src/compiler/scala/tools/nsc/plugins/Plugin.scala @@ -144,7 +144,7 @@ object Plugin { // (j, Try(descriptor)) def required(j: Path) = j -> loadDescriptionFromJar(j) - type Paired = Pair[Path, Try[PluginDescription]] + type Paired = Tuple2[Path, Try[PluginDescription]] val included: List[Paired] = (dirs flatMap (_ ifDirectory scan)).flatten val exploded: List[Paired] = jars flatMap (_ ifDirectory explode) val explicit: List[Paired] = jars flatMap (_ ifFile required) |