summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-11-22 03:12:36 -0800
committerJason Zaugg <jzaugg@gmail.com>2013-11-22 03:12:36 -0800
commit666f39d3493ee633a616c40f1c41add1190a3a40 (patch)
treea62015e39bfdd6235bdcf0bef31fc31342ea60b6 /src
parent42657a6918ef7d6fd3f36838739ec8a3b64744a3 (diff)
parentb004c3ddb38f8e690a0895a51ad0c83ff57a01e7 (diff)
downloadscala-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')
-rw-r--r--src/actors/scala/actors/Future.scala14
-rw-r--r--src/actors/scala/actors/remote/NetKernel.scala8
-rw-r--r--src/actors/scala/actors/remote/Proxy.scala4
-rw-r--r--src/actors/scala/actors/remote/RemoteActor.scala4
-rw-r--r--src/actors/scala/actors/remote/TcpService.scala8
-rw-r--r--src/compiler/scala/tools/ant/ScalaTool.scala4
-rw-r--r--src/compiler/scala/tools/ant/sabbus/Compilers.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/analysis/Liveness.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/analysis/TypeFlowAnalysis.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala8
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeHelpers.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeSkelBuilder.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeTypes.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala20
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala6
-rw-r--r--src/compiler/scala/tools/nsc/plugins/Plugin.scala2
-rw-r--r--src/library/scala/Predef.scala6
-rw-r--r--src/repl/scala/tools/nsc/interpreter/JavapClass.scala2
-rw-r--r--src/scaladoc/scala/tools/ant/Scaladoc.scala6
-rw-r--r--src/scalap/scala/tools/scalap/Arguments.scala6
20 files changed, 58 insertions, 56 deletions
diff --git a/src/actors/scala/actors/Future.scala b/src/actors/scala/actors/Future.scala
index 9d123cb2d5..4421c7a07a 100644
--- a/src/actors/scala/actors/Future.scala
+++ b/src/actors/scala/actors/Future.scala
@@ -180,17 +180,17 @@ object Futures {
var cnt = 0
val mappedFts = fts.map(ft =>
- Pair({cnt+=1; cnt-1}, ft))
+ ({cnt+=1; cnt-1}, ft))
- val unsetFts = mappedFts.filter((p: Pair[Int, Future[Any]]) => {
+ val unsetFts = mappedFts.filter((p: Tuple2[Int, Future[Any]]) => {
if (p._2.isSet) { resultsMap(p._1) = Some(p._2()); false }
else { resultsMap(p._1) = None; true }
})
- val partFuns = unsetFts.map((p: Pair[Int, Future[Any]]) => {
+ val partFuns = unsetFts.map((p: Tuple2[Int, Future[Any]]) => {
val FutCh = p._2.inputChannel
- val singleCase: PartialFunction[Any, Pair[Int, Any]] = {
- case FutCh ! any => Pair(p._1, any)
+ val singleCase: PartialFunction[Any, Tuple2[Int, Any]] = {
+ case FutCh ! any => (p._1, any)
}
singleCase
})
@@ -201,7 +201,7 @@ object Futures {
}
Actor.timer.schedule(timerTask, timeout)
- def awaitWith(partFuns: Seq[PartialFunction[Any, Pair[Int, Any]]]) {
+ def awaitWith(partFuns: Seq[PartialFunction[Any, Tuple2[Int, Any]]]) {
val reaction: PartialFunction[Any, Unit] = new PartialFunction[Any, Unit] {
def isDefinedAt(msg: Any) = msg match {
case TIMEOUT => true
@@ -212,7 +212,7 @@ object Futures {
case _ => {
val pfOpt = partFuns find (_ isDefinedAt msg)
val pf = pfOpt.get // succeeds always
- val Pair(idx, subres) = pf(msg)
+ val (idx, subres) = pf(msg)
resultsMap(idx) = Some(subres)
val partFunsRest = partFuns filter (_ != pf)
diff --git a/src/actors/scala/actors/remote/NetKernel.scala b/src/actors/scala/actors/remote/NetKernel.scala
index 4795ff3eb6..57d7af6d26 100644
--- a/src/actors/scala/actors/remote/NetKernel.scala
+++ b/src/actors/scala/actors/remote/NetKernel.scala
@@ -43,8 +43,8 @@ private[remote] class NetKernel(service: Service) {
private val names = new mutable.HashMap[OutputChannel[Any], Symbol]
def register(name: Symbol, a: OutputChannel[Any]): Unit = synchronized {
- actors += Pair(name, a)
- names += Pair(a, name)
+ actors(name) = a
+ names(a) = name
}
def getOrCreateName(from: OutputChannel[Any]) = names.get(from) match {
@@ -79,7 +79,7 @@ private[remote] class NetKernel(service: Service) {
def createProxy(node: Node, sym: Symbol): Proxy = {
val p = new Proxy(node, sym, this)
- proxies += Pair((node, sym), p)
+ proxies((node, sym)) = p
p
}
@@ -99,7 +99,7 @@ private[remote] class NetKernel(service: Service) {
proxies.synchronized {
proxies.get((senderNode, senderName)) match {
case Some(senderProxy) => // do nothing
- case None => proxies += Pair((senderNode, senderName), p)
+ case None => proxies((senderNode, senderName)) = p
}
}
diff --git a/src/actors/scala/actors/remote/Proxy.scala b/src/actors/scala/actors/remote/Proxy.scala
index 43a43ac99c..9949b36181 100644
--- a/src/actors/scala/actors/remote/Proxy.scala
+++ b/src/actors/scala/actors/remote/Proxy.scala
@@ -142,7 +142,7 @@ private[remote] class DelegateActor(creator: Proxy, node: Node, name: Symbol, ke
// create a new reply channel...
val replyCh = new Channel[Any](this)
// ...that maps to session
- sessionMap += Pair(replyCh, session)
+ sessionMap(replyCh) = session
// local send
out.send(msg, replyCh)
@@ -178,7 +178,7 @@ private[remote] class DelegateActor(creator: Proxy, node: Node, name: Symbol, ke
// create fresh session ID...
val fresh = FreshNameCreator.newName(node+"@"+name)
// ...that maps to reply channel
- channelMap += Pair(fresh, sender)
+ channelMap(fresh) = sender
kernel.forward(sender, node, name, msg, fresh)
} else {
kernel.forward(sender, node, name, msg, 'nosession)
diff --git a/src/actors/scala/actors/remote/RemoteActor.scala b/src/actors/scala/actors/remote/RemoteActor.scala
index 799076a01f..2daf9ceb43 100644
--- a/src/actors/scala/actors/remote/RemoteActor.scala
+++ b/src/actors/scala/actors/remote/RemoteActor.scala
@@ -64,7 +64,7 @@ object RemoteActor {
val serv = TcpService(port, cl)
val kern = serv.kernel
val s = Actor.self(Scheduler)
- kernels += Pair(s, kern)
+ kernels(s) = kern
s.onTerminate {
Debug.info("alive actor "+s+" terminated")
@@ -90,7 +90,7 @@ object RemoteActor {
val kernel = kernels.get(Actor.self(Scheduler)) match {
case None =>
val serv = TcpService(TcpService.generatePort, cl)
- kernels += Pair(Actor.self(Scheduler), serv.kernel)
+ kernels(Actor.self(Scheduler)) = serv.kernel
serv.kernel
case Some(k) =>
k
diff --git a/src/actors/scala/actors/remote/TcpService.scala b/src/actors/scala/actors/remote/TcpService.scala
index 75e36b2738..69e5c46c52 100644
--- a/src/actors/scala/actors/remote/TcpService.scala
+++ b/src/actors/scala/actors/remote/TcpService.scala
@@ -35,7 +35,7 @@ object TcpService {
service
case None =>
val service = new TcpService(port, cl)
- ports += Pair(port, service)
+ ports(port) = service
service.start()
Debug.info("created service at "+service.node)
service
@@ -106,9 +106,9 @@ class TcpService(port: Int, cl: ClassLoader) extends Thread with Service {
// when remote net kernel comes up
(pendingSends.get(node): @unchecked) match {
case None =>
- pendingSends += Pair(node, List(data))
+ pendingSends(node) = List(data)
case Some(msgs) if msgs.length < TcpService.BufSize =>
- pendingSends += Pair(node, data :: msgs)
+ pendingSends(node) = data :: msgs
}
}
@@ -183,7 +183,7 @@ class TcpService(port: Int, cl: ClassLoader) extends Thread with Service {
new mutable.HashMap[Node, TcpServiceWorker]
private[actors] def addConnection(node: Node, worker: TcpServiceWorker) = synchronized {
- connections += Pair(node, worker)
+ connections(node) = worker
}
def getConnection(n: Node) = synchronized {
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)
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala
index cd96b5182c..8900450fa3 100644
--- a/src/library/scala/Predef.scala
+++ b/src/library/scala/Predef.scala
@@ -26,8 +26,6 @@ import scala.io.ReadStdin
* [[scala.collection.immutable.Set]], and the [[scala.collection.immutable.List]]
* constructors ([[scala.collection.immutable.::]] and
* [[scala.collection.immutable.Nil]]).
- * The types `Pair` (a [[scala.Tuple2]]) and `Triple` (a [[scala.Tuple3]]), with
- * simple constructors, are also provided.
*
* === Console I/O ===
* Predef provides a number of simple functions for console I/O, such as
@@ -230,13 +228,17 @@ object Predef extends LowPriorityImplicits with DeprecatedPredef {
// tupling ------------------------------------------------------------
+ @deprecated("Use built-in tuple syntax or Tuple2 instead", "2.11.0")
type Pair[+A, +B] = Tuple2[A, B]
+ @deprecated("Use built-in tuple syntax or Tuple2 instead", "2.11.0")
object Pair {
def apply[A, B](x: A, y: B) = Tuple2(x, y)
def unapply[A, B](x: Tuple2[A, B]): Option[Tuple2[A, B]] = Some(x)
}
+ @deprecated("Use built-in tuple syntax or Tuple3 instead", "2.11.0")
type Triple[+A, +B, +C] = Tuple3[A, B, C]
+ @deprecated("Use built-in tuple syntax or Tuple3 instead", "2.11.0")
object Triple {
def apply[A, B, C](x: A, y: B, z: C) = Tuple3(x, y, z)
def unapply[A, B, C](x: Tuple3[A, B, C]): Option[Tuple3[A, B, C]] = Some(x)
diff --git a/src/repl/scala/tools/nsc/interpreter/JavapClass.scala b/src/repl/scala/tools/nsc/interpreter/JavapClass.scala
index 50c90968af..496d5face1 100644
--- a/src/repl/scala/tools/nsc/interpreter/JavapClass.scala
+++ b/src/repl/scala/tools/nsc/interpreter/JavapClass.scala
@@ -180,7 +180,7 @@ class JavapClass(
/** Base class for javap tool adapters for java 6 and 7. */
abstract class JavapTool {
type ByteAry = Array[Byte]
- type Input = Pair[String, Try[ByteAry]]
+ type Input = Tuple2[String, Try[ByteAry]]
/** Run the tool. */
def apply(raw: Boolean, options: Seq[String])(inputs: Seq[Input]): List[JpResult]
diff --git a/src/scaladoc/scala/tools/ant/Scaladoc.scala b/src/scaladoc/scala/tools/ant/Scaladoc.scala
index fd6d637212..36a1405b11 100644
--- a/src/scaladoc/scala/tools/ant/Scaladoc.scala
+++ b/src/scaladoc/scala/tools/ant/Scaladoc.scala
@@ -574,7 +574,7 @@ class Scaladoc extends ScalaMatchingTask {
\*============================================================================*/
/** Initializes settings and source files */
- protected def initialize: Pair[Settings, List[File]] = {
+ protected def initialize: Tuple2[Settings, List[File]] = {
// Tests if all mandatory attributes are set and valid.
if (origin.isEmpty) buildError("Attribute 'srcdir' is not set.")
if (getOrigin.isEmpty) buildError("Attribute 'srcdir' is not set.")
@@ -660,14 +660,14 @@ class Scaladoc extends ScalaMatchingTask {
log("Scaladoc params = '" + addParams + "'", Project.MSG_DEBUG)
docSettings processArgumentString addParams
- Pair(docSettings, sourceFiles)
+ (docSettings, sourceFiles)
}
def safeBuildError(message: String): Unit = if (nofail) log(message) else buildError(message)
/** Performs the compilation. */
override def execute() = {
- val Pair(docSettings, sourceFiles) = initialize
+ val (docSettings, sourceFiles) = initialize
val reporter = new ConsoleReporter(docSettings)
try {
val docProcessor = new scala.tools.nsc.doc.DocFactory(reporter, docSettings)
diff --git a/src/scalap/scala/tools/scalap/Arguments.scala b/src/scalap/scala/tools/scalap/Arguments.scala
index 41346d13c0..cb0a92b6b3 100644
--- a/src/scalap/scala/tools/scalap/Arguments.scala
+++ b/src/scalap/scala/tools/scalap/Arguments.scala
@@ -46,8 +46,8 @@ object Arguments {
}
def parseBinding(str: String, separator: Char): (String, String) = (str indexOf separator) match {
- case -1 => argumentError("missing '" + separator + "' in binding '" + str + "'") ; Pair("", "")
- case idx => Pair((str take idx).trim, (str drop (idx + 1)).trim)
+ case -1 => argumentError("missing '" + separator + "' in binding '" + str + "'") ; ("", "")
+ case idx => ((str take idx).trim, (str drop (idx + 1)).trim)
}
def parse(args: Array[String]): Arguments = {
@@ -141,7 +141,7 @@ class Arguments {
if (key.length > 0)
bindings.getOrElseUpdate(tag, new mutable.HashMap)(key) = value
- def addBinding(tag: String, binding: Pair[String, String]): Unit =
+ def addBinding(tag: String, binding: Tuple2[String, String]): Unit =
addBinding(tag, binding._1, binding._2)
def addOther(arg: String): Unit = others += arg