summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-02-05 16:18:55 +0000
committerMartin Odersky <odersky@gmail.com>2007-02-05 16:18:55 +0000
commit912077c5f8d59b2585a3a5014c193a8399b672d1 (patch)
tree5da612486be4b8204fcf55c1f8ab57fc6b4caec9 /src
parent9304e2a7a6923b2b81f1e76cae408a6ef195bff0 (diff)
downloadscala-912077c5f8d59b2585a3a5014c193a8399b672d1.tar.gz
scala-912077c5f8d59b2585a3a5014c193a8399b672d1.tar.bz2
scala-912077c5f8d59b2585a3a5014c193a8399b672d1.zip
changed pair(...) to {...}
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreePrinters.scala24
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala26
-rw-r--r--src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala4
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala7
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala6
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala24
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala10
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala20
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala43
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala16
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala4
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala34
-rw-r--r--src/library/scala/BigInt.scala4
-rw-r--r--src/library/scala/Console.scala6
-rw-r--r--src/library/scala/Iterator.scala12
-rw-r--r--src/library/scala/List.scala42
-rw-r--r--src/library/scala/Stream.scala2
-rw-r--r--src/library/scala/collection/Map.scala4
-rw-r--r--src/library/scala/collection/MapProxy.scala2
-rwxr-xr-xsrc/library/scala/collection/immutable/HashMap.scala2
-rw-r--r--src/library/scala/collection/immutable/ListMap.scala10
-rw-r--r--src/library/scala/collection/immutable/Map.scala26
-rwxr-xr-xsrc/library/scala/collection/immutable/Map1.scala2
-rwxr-xr-xsrc/library/scala/collection/immutable/Map2.scala2
-rwxr-xr-xsrc/library/scala/collection/immutable/Map3.scala2
-rwxr-xr-xsrc/library/scala/collection/immutable/Map4.scala2
-rw-r--r--src/library/scala/collection/immutable/Queue.scala12
-rwxr-xr-xsrc/library/scala/collection/immutable/RedBlack.scala8
-rw-r--r--src/library/scala/collection/immutable/Set.scala2
-rw-r--r--src/library/scala/collection/immutable/Tree.scala48
-rw-r--r--src/library/scala/collection/immutable/TreeMap.scala4
-rwxr-xr-xsrc/library/scala/collection/immutable/UnbalancedTreeMap.scala8
-rw-r--r--src/library/scala/collection/mutable/ArrayBuffer.scala2
-rw-r--r--src/library/scala/collection/mutable/Buffer.scala10
-rw-r--r--src/library/scala/collection/mutable/BufferProxy.scala2
-rw-r--r--src/library/scala/collection/mutable/HashMap.scala2
-rw-r--r--src/library/scala/collection/mutable/History.scala10
-rw-r--r--src/library/scala/collection/mutable/ImmutableMapAdaptor.scala4
-rw-r--r--src/library/scala/collection/mutable/JavaMapAdaptor.scala4
-rw-r--r--src/library/scala/collection/mutable/ListBuffer.scala2
-rw-r--r--src/library/scala/collection/mutable/Map.scala40
-rw-r--r--src/library/scala/collection/mutable/MapProxy.scala20
-rw-r--r--src/library/scala/collection/mutable/ObservableBuffer.scala12
-rw-r--r--src/library/scala/collection/mutable/ObservableMap.scala8
-rw-r--r--src/library/scala/collection/mutable/PriorityQueue.scala2
-rw-r--r--src/library/scala/collection/mutable/Queue.scala2
-rw-r--r--src/library/scala/collection/mutable/RevertableHistory.scala2
-rw-r--r--src/library/scala/collection/mutable/Set.scala2
-rw-r--r--src/library/scala/collection/mutable/Stack.scala2
-rw-r--r--src/library/scala/collection/mutable/SynchronizedBuffer.scala2
-rw-r--r--src/library/scala/collection/mutable/SynchronizedMap.scala20
-rw-r--r--src/library/scala/concurrent/MailBox.scala22
-rw-r--r--src/library/scala/concurrent/Process.scala2
-rw-r--r--src/library/scala/concurrent/jolib.scala10
-rw-r--r--src/library/scala/concurrent/ops.scala4
-rw-r--r--src/library/scala/concurrent/pilib.scala15
-rw-r--r--src/library/scala/mobile/Code.scala18
-rw-r--r--src/library/scala/reflect/Type.scala2
-rw-r--r--src/library/scala/text/Document.scala44
-rw-r--r--src/library/scala/xml/MetaData.scala2
61 files changed, 336 insertions, 351 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
index 0e687d7bfc..0ce8c00bf3 100644
--- a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
@@ -105,31 +105,11 @@ abstract class TreePrinters {
}
def printAttributes(tree: Tree): unit = {
- def attrInfoToString(attr: AttrInfo): String = {
- val str = new StringBuilder()
- attr match {
- case AttrInfo(tp, args, nvPairs) =>
- str.append(tp.toString())
- if (!args.isEmpty)
- str.append(args.map(.escapedStringValue).mkString("(", ",", ")"))
- if (!nvPairs.isEmpty)
- for (val {Pair(name, value), index} <- nvPairs.zipWithIndex) {
- if (index > 0)
- str.append(", ")
- str.append(name).append(" = ").append(value)
- }
- str.toString
- }
- }
val attrs = tree.symbol.attributes
- if (!attrs.isEmpty) {
- print(attrs.map(attrInfoToString).mkString("[", ",", "]"))
- }
+ if (!attrs.isEmpty) print(attrs mkString ("[", ", ", "]"))
else {
val attrs = tree.asInstanceOf[MemberDef].mods.attributes
- if (!attrs.isEmpty) {
- printRow(attrs, "[", ",", "]")
- }
+ if (!attrs.isEmpty) printRow(attrs, "[", ", ", "]")
}
}
diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
index 91490f1c9c..ca1eb1005c 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
@@ -57,16 +57,16 @@ abstract class TreeBuilder {
/** Traverse pattern and collect all variable names with their types in buffer */
private object getvarTraverser extends Traverser {
- val buf = new ListBuffer[Pair[Name, Tree]]
+ val buf = new ListBuffer[{Name, Tree}]
def init: Traverser = { buf.clear; this }
override def traverse(tree: Tree): unit = tree match {
case Bind(name, Typed(tree1, tpt)) =>
if ((name != nme.WILDCARD) && (buf.elements forall (name !=)))
- buf += Pair(name, tpt)
+ buf += {name, tpt}
traverse(tree1)
case Bind(name, tree1) =>
if ((name != nme.WILDCARD) && (buf.elements forall (name !=)))
- buf += Pair(name, TypeTree())
+ buf += {name, TypeTree()}
traverse(tree1)
case _ =>
super.traverse(tree)
@@ -76,7 +76,7 @@ abstract class TreeBuilder {
/** Returns list of all pattern variables, possibly with their types,
* without duplicates
*/
- private def getVariables(tree: Tree): List[Pair[Name, Tree]] = {
+ private def getVariables(tree: Tree): List[{Name, Tree}] = {
getvarTraverser.init.traverse(tree)
getvarTraverser.buf.toList
}
@@ -105,11 +105,11 @@ abstract class TreeBuilder {
/** If tree is a variable pattern, return Some("its name and type").
* Otherwise return none */
- private def matchVarPattern(tree: Tree): Option[Pair[Name, Tree]] = tree match {
- case Ident(name) => Some(Pair(name, TypeTree()))
- case Bind(name, Ident(nme.WILDCARD)) => Some(Pair(name, TypeTree()))
- case Typed(Ident(name), tpt) => Some(Pair(name, tpt))
- case Bind(name, Typed(Ident(nme.WILDCARD), tpt)) => Some(Pair(name, tpt))
+ private def matchVarPattern(tree: Tree): Option[{Name, Tree}] = tree match {
+ case Ident(name) => Some{name, TypeTree()}
+ case Bind(name, Ident(nme.WILDCARD)) => Some{name, TypeTree()}
+ case Typed(Ident(name), tpt) => Some{name, tpt}
+ case Bind(name, Typed(Ident(nme.WILDCARD), tpt)) => Some{name, tpt}
case _ => None
}
@@ -255,7 +255,7 @@ abstract class TreeBuilder {
private def makeFor(mapName: Name, flatMapName: Name, enums: List[Enumerator], body: Tree): Tree = {
def makeClosure(pat: Tree, body: Tree): Tree = matchVarPattern(pat) match {
- case Some(Pair(name, tpt)) =>
+ case Some{name, tpt} =>
Function(List(ValDef(Modifiers(PARAM), name, tpt, EmptyTree)), body)
case None =>
makeVisitor(List(CaseDef(pat, EmptyTree, body)), false)
@@ -377,7 +377,7 @@ abstract class TreeBuilder {
/** Create tree for pattern definition &lt;mods val pat0 = rhs&gt; */
def makePatDef(mods: Modifiers, pat: Tree, rhs: Tree): List[Tree] = matchVarPattern(pat) match {
- case Some(Pair(name, tpt)) =>
+ case Some{name, tpt} =>
List(ValDef(mods, name, tpt, rhs))
case None =>
@@ -400,13 +400,13 @@ abstract class TreeBuilder {
vars match {
case List() =>
List(matchExpr)
- case List(Pair(vname, tpt)) =>
+ case List{vname, tpt} =>
List(ValDef(mods, vname, tpt, matchExpr))
case _ =>
val tmp = freshName()
val firstDef = ValDef(Modifiers(PRIVATE | LOCAL | SYNTHETIC), tmp, TypeTree(), matchExpr)
var cnt = 0
- val restDefs = for (val Pair(vname, tpt) <- vars) yield {
+ val restDefs = for (val {vname, tpt} <- vars) yield {
cnt = cnt + 1
ValDef(mods, vname, tpt, Select(Ident(tmp), newTermName("_" + cnt)))
}
diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
index 3df8884e50..699dc0909e 100644
--- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
+++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
@@ -161,7 +161,7 @@ abstract class SymbolLoaders {
//if (! classes.isEmpty) System.err.println("COMPLETE: " + classes)
// do classes first
- for (val Pair(name, file) <- classes.elements) {
+ for (val {name, file} <- classes.elements) {
val loader = if (!file.isSourceFile) {
new ClassfileLoader(file.classFile, file.sourceFile, file.sourcePath);
} else {
@@ -170,7 +170,7 @@ abstract class SymbolLoaders {
}
enterClassAndModule(name, loader)
}
- for (val Pair(name, file) <- packages.elements)
+ for (val {name, file} <- packages.elements)
enterPackage(name, new PackageLoader(file))
}
protected def kindString: String = "directory path"
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index a586f7c026..fad85cfc4a 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -1306,7 +1306,12 @@ trait Symbols requires SymbolTable {
def cloneSymbolImpl(owner: Symbol): Symbol = throw new Error()
}
- case class AttrInfo(atp: Type, args: List[Constant], assocs: List[{Name, Constant}])
+ case class AttrInfo(atp: Type, args: List[Constant], assocs: List[{Name, Constant}]) {
+ override def toString: String =
+ atp +
+ (if (args.isEmpty) "" else args.mkString("(", ", ", ")")) +
+ (assocs map { case Pair(x, y) => x+" = "+y } mkString ("{", ", ", "}"))
+ }
def cloneSymbols(syms: List[Symbol]): List[Symbol] = {
val syms1 = syms map (.cloneSymbol)
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 058e6bf675..d995c0d082 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -193,7 +193,7 @@ abstract class ClassfileParser {
in.buf(start) != CONSTANT_METHODREF &&
in.buf(start) != CONSTANT_INTFMETHODREF) errorBadTag(start)
val ownerTpe = getClassOrArrayType(in.getChar(start + 1))
- val Pair(name, tpe) = getNameAndType(in.getChar(start + 3), ownerTpe)
+ val {name, tpe} = getNameAndType(in.getChar(start + 3), ownerTpe)
if (name == nme.MODULE_INSTANCE_FIELD) {
val index = in.getChar(start + 1)
val name = getExternalName(in.getChar(starts(index) + 1))
@@ -232,7 +232,7 @@ abstract class ClassfileParser {
tpe = MethodType(formals, ownerTpe)
}
- p = Pair(name, tpe)
+ p = {name, tpe}
}
p
}
@@ -700,7 +700,7 @@ abstract class ClassfileParser {
val nvpairs = new ListBuffer[Pair[Name,Constant]]
for (val i <- 0 until nargs) {
val name = pool.getName(in.nextChar)
- nvpairs += Pair(name, parseTaggedConstant())
+ nvpairs += {name, parseTaggedConstant()}
}
sym.attributes = AttrInfo(attrType, List(), nvpairs.toList) :: sym.attributes
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala b/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala
index 7323b17fa3..1610d237e0 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala
@@ -49,21 +49,21 @@ abstract class ConstantFolder {
// compiler itself crashing
}
- private def foldUnop(op: Name, x: Constant): Constant = Pair(op, x.tag) match {
- case Pair(nme.ZNOT, BooleanTag) => Constant(!x.booleanValue)
+ private def foldUnop(op: Name, x: Constant): Constant = {op, x.tag} match {
+ case {nme.ZNOT, BooleanTag} => Constant(!x.booleanValue)
- case Pair(nme.NOT , IntTag ) => Constant(~x.intValue)
- case Pair(nme.NOT , LongTag ) => Constant(~x.longValue)
+ case {nme.NOT , IntTag } => Constant(~x.intValue)
+ case {nme.NOT , LongTag } => Constant(~x.longValue)
- case Pair(nme.ADD , IntTag ) => Constant(+x.intValue)
- case Pair(nme.ADD , LongTag ) => Constant(+x.longValue)
- case Pair(nme.ADD , FloatTag ) => Constant(+x.floatValue)
- case Pair(nme.ADD , DoubleTag ) => Constant(+x.doubleValue)
+ case {nme.ADD , IntTag } => Constant(+x.intValue)
+ case {nme.ADD , LongTag } => Constant(+x.longValue)
+ case {nme.ADD , FloatTag } => Constant(+x.floatValue)
+ case {nme.ADD , DoubleTag } => Constant(+x.doubleValue)
- case Pair(nme.SUB , IntTag ) => Constant(-x.intValue)
- case Pair(nme.SUB , LongTag ) => Constant(-x.longValue)
- case Pair(nme.SUB , FloatTag ) => Constant(-x.floatValue)
- case Pair(nme.SUB , DoubleTag ) => Constant(-x.doubleValue)
+ case {nme.SUB , IntTag } => Constant(-x.intValue)
+ case {nme.SUB , LongTag } => Constant(-x.longValue)
+ case {nme.SUB , FloatTag } => Constant(-x.floatValue)
+ case {nme.SUB , DoubleTag } => Constant(-x.doubleValue)
case _ => null
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 0fb3d02cc5..72f8d8540e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -41,7 +41,7 @@ trait Contexts requires Analyzer {
assert(pkg ne null)
val qual = gen.mkAttributedStableRef(pkg)
sc = sc.makeNewImport(
- Import(qual, List(Pair(nme.WILDCARD, null)))
+ Import(qual, List({nme.WILDCARD, null}))
.setSymbol(NoSymbol.newImport(NoPos).setFlag(SYNTHETIC).setInfo(ImportType(qual)))
.setType(NoType))
sc.depth = sc.depth + 1
@@ -364,12 +364,12 @@ trait Contexts requires Analyzer {
}
def pushTypeBounds(sym: Symbol): unit = {
- savedTypeBounds = Pair(sym, sym.info) :: savedTypeBounds
+ savedTypeBounds = {sym, sym.info} :: savedTypeBounds
}
def restoreTypeBounds(tp: Type): Type = {
var current = tp
- for (val Pair(sym, info) <- savedTypeBounds) {
+ for (val {sym, info} <- savedTypeBounds) {
if (settings.debug.value) log("resetting " + sym + " to " + info);
sym.info match {
case TypeBounds(lo, hi) if (hi <:< lo && lo <:< hi) =>
@@ -393,8 +393,8 @@ trait Contexts requires Analyzer {
val pre = imp.qual.tpe
def collect(sels: List[Pair[Name, Name]]): List[ImplicitInfo] = sels match {
case List() => List()
- case List(Pair(nme.WILDCARD, _)) => collectImplicits(pre.implicitMembers, pre)
- case Pair(from, to) :: sels1 =>
+ case List{nme.WILDCARD, _} => collectImplicits(pre.implicitMembers, pre)
+ case {from, to} :: sels1 =>
var impls = collect(sels1) filter (info => info.name != from)
if (to != nme.WILDCARD) {
val sym = imp.importedSymbol(to)
diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
index a52773fbfd..3e63401356 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -134,7 +134,7 @@ trait Infer requires Analyzer {
val bound: Type = if (up) tparam.info.bounds.hi else tparam.info.bounds.lo
//Console.println("solveOne0 "+tvar+" "+config+" "+bound);//DEBUG
var cyclic = false
- for (val Pair(tvar2, Pair(tparam2, variance2)) <- config) {
+ for (val {tvar2, {tparam2, variance2}} <- config) {
if (tparam2 != tparam &&
((bound contains tparam2) ||
up && (tparam2.info.bounds.lo =:= tparam.tpe) ||
@@ -170,7 +170,7 @@ trait Infer requires Analyzer {
assertNonCyclic(tvar)//debug
}
}
- for (val Pair(tvar, Pair(tparam, variance)) <- config)
+ for (val {tvar, {tparam, variance}} <- config)
solveOne(tvar, tparam, variance)
tvars map instantiate
}
@@ -295,13 +295,13 @@ trait Infer requires Analyzer {
explainName(sym1)
explainName(sym2)
if (sym1.owner == sym2.owner) sym2.name = newTypeName("(some other)"+sym2.name)
- Triple(sym1, sym2, name)
+ {sym1, sym2, name}
}
}
val result = op
- for (val Triple(sym1, sym2, name) <- patches) {
+ for (val {sym1, sym2, name} <- patches) {
sym1.name = name
sym2.name = name
}
@@ -685,8 +685,8 @@ trait Infer requires Analyzer {
* any correspondiong non-variant type arguments of bt1 and bt2 are the same
*/
def isPopulated(tp1: Type, tp2: Type): boolean = {
- def isConsistent(tp1: Type, tp2: Type): boolean = Pair(tp1, tp2) match {
- case Pair(TypeRef(pre1, sym1, args1), TypeRef(pre2, sym2, args2)) =>
+ def isConsistent(tp1: Type, tp2: Type): boolean = {tp1, tp2} match {
+ case {TypeRef(pre1, sym1, args1), TypeRef(pre2, sym2, args2)} =>
assert(sym1 == sym2)
pre1 =:= pre2 &&
!(List.map3(args1, args2, sym1.typeParams) {
@@ -773,11 +773,9 @@ trait Infer requires Analyzer {
if (settings.debug.value) log("new alias of " + tparam + " = " + tparam.info)
} else {
val instType = toOrigin(tvar.constr.inst)
- val Pair(loBounds, hiBounds) =
- if (instType != NoType && isFullyDefined(instType))
- Pair(List(instType), List(instType))
- else
- Pair(tvar.constr.lobounds, tvar.constr.hibounds)
+ val {loBounds, hiBounds} =
+ if (instType != NoType && isFullyDefined(instType)) {List(instType), List(instType)}
+ else {tvar.constr.lobounds, tvar.constr.hibounds}
val lo = lub(tparam.info.bounds.lo :: loBounds map toOrigin)
val hi = glb(tparam.info.bounds.hi :: hiBounds map toOrigin)
if (!(lo <:< hi)) {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 2bc9023485..e3b4fbd33e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -219,7 +219,7 @@ trait Namers requires Analyzer {
def skolemize(tparams: List[AbsTypeDef]): unit = {
val tskolems = newTypeSkolems(tparams map (.symbol))
- for (val Pair(tparam, tskolem) <- tparams zip tskolems) tparam.symbol = tskolem
+ for (val {tparam, tskolem} <- tparams zip tskolems) tparam.symbol = tskolem
}
def applicableTypeParams(owner: Symbol): List[Symbol] =
@@ -460,21 +460,23 @@ trait Namers requires Analyzer {
if (vparamSymss.isEmpty) PolyType(List(), restype)
else (vparamSymss :\ restype)(makeMethodType))
+ var resultPt = if (tpt.isEmpty) WildcardType else typer.typedType(tpt).tpe
+
if (meth.owner.isClass && (tpt.isEmpty || vparamss.exists(.exists(.tpt.isEmpty)))) {
// try to complete from matching definition in base type
for (val vparams <- vparamss; val vparam <- vparams)
if (vparam.tpt.isEmpty) vparam.symbol setInfo WildcardType
- val schema = thisMethodType(if (tpt.isEmpty) WildcardType else typer.typedType(tpt).tpe)
+ val schema = thisMethodType(resultPt)
val site = meth.owner.thisType
val overridden = intersectionType(meth.owner.info.parents).member(meth.name).filter(sym =>
sym != NoSymbol && (site.memberType(sym) matches schema))
if (overridden != NoSymbol && !(overridden hasFlag OVERLOADED)) {
- var pt = site.memberType(overridden) match {
- case PolyType(tparams, rt) => rt.substSym(tparamSyms, tparams)
+ resultPt = site.memberType(overridden) match {
+ case PolyType(tparams, rt) => rt.substSym(tparams, tparamSyms)
case mt => mt
}
for (val vparams <- vparamss) {
- var pfs = pt.paramTypes
+ var pfs = resultPt.paramTypes
for (val vparam <- vparams) {
if (vparam.tpt.isEmpty) {
vparam.tpt.tpe = pfs.head
@@ -482,17 +484,17 @@ trait Namers requires Analyzer {
}
pfs = pfs.tail
}
- pt = pt.resultType
+ resultPt = resultPt.resultType
+ }
+ resultPt match {
+ case PolyType(List(), rtpe) => resultPt = rtpe
+ case MethodType(List(), rtpe) => resultPt = rtpe
+ case _ =>
}
if (tpt.isEmpty) {
// provisionally assign `meth' a method type with inherited result type
// that way, we can leave out the result type even if method is recursive.
- meth setInfo thisMethodType(
- pt match {
- case PolyType(List(), rtpe) => rtpe
- case MethodType(List(), rtpe) => rtpe
- case _ => pt
- })
+ meth setInfo thisMethodType(resultPt)
}
}
}
@@ -504,7 +506,8 @@ trait Namers requires Analyzer {
thisMethodType(
if (tpt.isEmpty) {
- tpt.tpe = deconstIfNotFinal(meth, typer.computeType(rhs));
+ val pt = resultPt.substSym(tparamSyms, tparams map (.symbol))
+ tpt.tpe = deconstIfNotFinal(meth, typer.computeType(rhs, WildcardType/*pt*/))
tpt.tpe
} else typer.typedType(tpt).tpe)
}
@@ -578,7 +581,7 @@ trait Namers requires Analyzer {
context.error(tpt.pos, "missing parameter type");
ErrorType
} else {
- tpt.tpe = deconstIfNotFinal(sym, newTyper(context.make(tree, sym)).computeType(rhs));
+ tpt.tpe = deconstIfNotFinal(sym, newTyper(context.make(tree, sym)).computeType(rhs, WildcardType));
tpt.tpe
}
} else {
@@ -622,8 +625,8 @@ trait Namers requires Analyzer {
}
true
}
- def checkSelectors(selectors: List[Pair[Name, Name]]): unit = selectors match {
- case Pair(from, to) :: rest =>
+ def checkSelectors(selectors: List[{Name, Name}]): unit = selectors match {
+ case {from, to} :: rest =>
if (from != nme.WILDCARD && base != ErrorType) {
if (base.member(from) == NoSymbol && base.member(from.toTypeName) == NoSymbol)
context.error(tree.pos, from.decode + " is not a member of " + expr);
@@ -684,12 +687,12 @@ trait Namers requires Analyzer {
error(ntree.pos, "duplicate value for element " + name)
} else {
names -= sym
- Pair(sym.name, getConstant(typer.typed(rhs, EXPRmode | CONSTmode, sym.tpe.resultType)))
+ {sym.name, getConstant(typer.typed(rhs, EXPRmode | CONSTmode, sym.tpe.resultType))}
}
}
}
for (val name <- names) {
- if (!name.attributes.contains(Triple(AnnotationDefaultAttr.tpe, List(), List()))) {
+ if (!name.attributes.contains{AnnotationDefaultAttr.tpe, List(), List()}) {
error(t.pos, "attribute " + tpt.tpe.symbol.fullNameString + " is missing element " + name.name)
}
}
@@ -781,8 +784,8 @@ trait Namers requires Analyzer {
else if (isFunctionType(tp) &&
(!isFunctionType(elemtp) || tp.typeArgs.length > elemtp.typeArgs.length))
result = true
- else Pair(tp, elemtp) match {
- case Pair(TypeRef(pre, sym, args), TypeRef(elempre, elemsym, elemargs)) =>
+ else {tp, elemtp} match {
+ case {TypeRef(pre, sym, args), TypeRef(elempre, elemsym, elemargs)} =>
if ((sym == elemsym) && (pre =:= elempre) && (args.length == elemargs.length))
result = List.forall2(elemargs, args) (isContainedIn)
case _ =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 43a2946c98..6dfba7ace7 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -100,12 +100,12 @@ abstract class RefChecks extends InfoTransform {
else "")))
}
- def overridesType(tp1: Type, tp2: Type): boolean = Pair(tp1, tp2) match {
- case Pair(MethodType(List(), rtp1), PolyType(List(), rtp2)) =>
+ def overridesType(tp1: Type, tp2: Type): boolean = {tp1, tp2} match {
+ case {MethodType(List(), rtp1), PolyType(List(), rtp2)} =>
rtp1 <:< rtp2
- case Pair(PolyType(List(), rtp1), MethodType(List(), rtp2)) =>
+ case {PolyType(List(), rtp1), MethodType(List(), rtp2)} =>
rtp1 <:< rtp2
- case Pair(TypeRef(_, sym, _), _) if (sym.isModuleClass) =>
+ case {TypeRef(_, sym, _), _} if (sym.isModuleClass) =>
overridesType(PolyType(List(), tp1), tp2)
case _ =>
tp1 <:< tp2
@@ -326,7 +326,7 @@ abstract class RefChecks extends InfoTransform {
while (sym != clazz && state != AnyVariance) {
//Console.println("flip: " + sym + " " + sym.isParameter());//DEBUG
if ((sym hasFlag PARAM) && !sym.owner.isConstructor) state = -state;
- else if (!sym.owner.isClass) state = AnyVariance;
+ else if (!sym.owner.isClass || sym.isPrivateLocal) state = AnyVariance;
else if (sym.isAliasType) state = NoVariance;
sym = sym.owner
}
@@ -375,7 +375,7 @@ abstract class RefChecks extends InfoTransform {
def validateVarianceArgs(tps: List[Type], variance: int, tparams: List[Symbol]): unit =
(tps zip tparams) foreach {
- case Pair(tp, tparam) => validateVariance(tp, variance * tparam.variance)
+ case {tp, tparam} => validateVariance(tp, variance * tparam.variance)
}
validateVariance(all, variance)
@@ -582,11 +582,11 @@ abstract class RefChecks extends InfoTransform {
validateVariance(sym, sym.typeOfThis, CoVariance)
case DefDef(_, _, _, _, _, _) =>
- validateVariance(sym, sym.tpe, CoVariance)
+ validateVariance(sym, sym.tpe, CoVariance)
checkDeprecatedOvers()
case ValDef(_, _, _, _) =>
- validateVariance(sym, sym.tpe, if (sym.isVariable) NoVariance else CoVariance)
+ validateVariance(sym, sym.tpe, if (sym.isVariable) NoVariance else CoVariance)
checkDeprecatedOvers()
case AbsTypeDef(_, _, _, _) =>
diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
index 51ed171076..84eb0cc9bf 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
@@ -36,7 +36,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
class SuperAccTransformer(unit: CompilationUnit) extends TypingTransformer(unit) {
private var validCurrentOwner = true
- private var accDefs: List[Pair[Symbol, ListBuffer[Tree]]] = List()
+ private var accDefs: List[{Symbol, ListBuffer[Tree]}] = List()
private def accDefBuf(clazz: Symbol) =
accDefs.dropWhile(._1.!=(clazz)).head._2
@@ -63,7 +63,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
super.transform(tree)
case Template(parents, body) =>
val ownAccDefs = new ListBuffer[Tree];
- accDefs = Pair(currentOwner, ownAccDefs) :: accDefs;
+ accDefs = {currentOwner, ownAccDefs} :: accDefs;
// ugly hack... normally, the following line should not be
// necessary, the 'super' method taking care of that. but because
diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
index 9c911f81fc..2f37c57306 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala
@@ -81,7 +81,7 @@ trait SyntheticMethods requires Analyzer {
//val retTpe = lub(accs map (.tpe.resultType))
val method = syntheticMethod(nme.element, FINAL, MethodType(List(IntClass.tpe), AnyClass.tpe/*retTpe*/))
typed(DefDef(method, vparamss => Match(Ident(vparamss.head.head), {
- (for(val Pair(sym,i) <- accs.zipWithIndex) yield {
+ (for(val {sym,i} <- accs.zipWithIndex) yield {
CaseDef(Literal(Constant(i)),EmptyTree, Ident(sym))
}):::List(CaseDef(Ident(nme.WILDCARD), EmptyTree,
Throw(New(TypeTree(IndexOutOfBoundsExceptionClass.tpe), List(List(
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 15ad5db003..4328a6b06e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -942,21 +942,21 @@ trait Typers requires Analyzer {
*/
def computeParamAliases(clazz: Symbol, vparamss: List[List[ValDef]], rhs: Tree): unit = {
if (settings.debug.value) log("computing param aliases for "+clazz+":"+clazz.primaryConstructor.tpe+":"+rhs);//debug
- def decompose(call: Tree): Pair[Tree, List[Tree]] = call match {
+ def decompose(call: Tree): {Tree, List[Tree]} = call match {
case Apply(fn, args) =>
- val Pair(superConstr, args1) = decompose(fn)
+ val {superConstr, args1} = decompose(fn)
val formals = fn.tpe.paramTypes
val args2 = if (formals.isEmpty || formals.last.symbol != RepeatedParamClass) args
else args.take(formals.length - 1) ::: List(EmptyTree)
if (args2.length != formals.length)
assert(false, "mismatch " + clazz + " " + formals + " " + args2);//debug
- Pair(superConstr, args1 ::: args2)
+ {superConstr, args1 ::: args2}
case Block(stats, expr) =>
decompose(stats.head)
case _ =>
- Pair(call, List())
+ {call, List()}
}
- val Pair(superConstr, superArgs) = decompose(rhs)
+ val {superConstr, superArgs} = decompose(rhs)
assert(superConstr.symbol ne null)//debug
if (superConstr.symbol.isPrimaryConstructor) {
val superClazz = superConstr.symbol.owner
@@ -1189,16 +1189,16 @@ trait Typers requires Analyzer {
def typedFunction(fun: Function, mode: int, pt: Type): Tree = {
val codeExpected = !forCLDC && (pt.symbol isNonBottomSubClass CodeClass)
- def decompose(pt: Type): Triple[Symbol, List[Type], Type] =
+ def decompose(pt: Type): {Symbol, List[Type], Type} =
if (isFunctionType(pt)
||
pt.symbol == PartialFunctionClass &&
fun.vparams.length == 1 && fun.body.isInstanceOf[Match])
- Triple(pt.symbol, pt.typeArgs.init, pt.typeArgs.last)
+ {pt.symbol, pt.typeArgs.init, pt.typeArgs.last}
else
- Triple(FunctionClass(fun.vparams.length), fun.vparams map (x => NoType), WildcardType)
+ {FunctionClass(fun.vparams.length), fun.vparams map (x => NoType), WildcardType}
- val Triple(clazz, argpts, respt) = decompose(if (codeExpected) pt.typeArgs.head else pt)
+ val {clazz, argpts, respt} = decompose(if (codeExpected) pt.typeArgs.head else pt)
if (fun.vparams.length != argpts.length)
errorTree(fun, "wrong number of parameters; expected = " + argpts.length)
@@ -2062,12 +2062,12 @@ trait Typers requires Analyzer {
}
case Super(qual, mix) =>
- val Pair(clazz, selftype) =
+ val {clazz, selftype} =
if (tree.symbol != NoSymbol) {
- Pair(tree.symbol, tree.symbol.thisType)
+ {tree.symbol, tree.symbol.thisType}
} else {
val clazzContext = qualifyingClassContext(tree, qual)
- Pair(clazzContext.owner, clazzContext.prefix)
+ {clazzContext.owner, clazzContext.prefix}
}
if (clazz == NoSymbol) setError(tree)
else {
@@ -2093,12 +2093,12 @@ trait Typers requires Analyzer {
}
case This(qual) =>
- val Pair(clazz, selftype) =
+ val {clazz, selftype} =
if (tree.symbol != NoSymbol) {
- Pair(tree.symbol, tree.symbol.thisType)
+ {tree.symbol, tree.symbol.thisType}
} else {
val clazzContext = qualifyingClassContext(tree, qual)
- Pair(clazzContext.owner, clazzContext.prefix)
+ {clazzContext.owner, clazzContext.prefix}
}
if (clazz == NoSymbol) setError(tree)
else {
@@ -2282,8 +2282,8 @@ trait Typers requires Analyzer {
result
}
- def computeType(tree: Tree): Type = {
- val tree1 = typed(tree)
+ def computeType(tree: Tree, pt: Type): Type = {
+ val tree1 = typed(tree, pt)
transformed(tree) = tree1
tree1.tpe
}
diff --git a/src/library/scala/BigInt.scala b/src/library/scala/BigInt.scala
index 9be8a45dbd..4fcbfd82ce 100644
--- a/src/library/scala/BigInt.scala
+++ b/src/library/scala/BigInt.scala
@@ -175,9 +175,9 @@ class BigInt(val bigInteger: BigInteger) extends runtime.BoxedNumber {
/** Returns a pair of two BigInts containing (this / that) and (this % that).
*/
- def /% (that: BigInt): Pair[BigInt, BigInt] = {
+ def /% (that: BigInt): {BigInt, BigInt} = {
val dr = this.bigInteger.divideAndRemainder(that.bigInteger)
- Pair(new BigInt(dr(0)), new BigInt(dr(1)))
+ {new BigInt(dr(0)), new BigInt(dr(1))}
}
/** Leftshift of BigInt
diff --git a/src/library/scala/Console.scala b/src/library/scala/Console.scala
index 553dda9860..3c075e8193 100644
--- a/src/library/scala/Console.scala
+++ b/src/library/scala/Console.scala
@@ -272,9 +272,9 @@ object Console {
* @param format ...
* @return ...
*/
- def readf2(format: String): Pair[Any, Any] = {
+ def readf2(format: String): {Any, Any} = {
val res = readf(format)
- Pair(res.head, res.tail.head)
+ {res.head, res.tail.head}
}
/** Read in some structured input, specified by a format specifier.
@@ -287,7 +287,7 @@ object Console {
*/
def readf3(format: String): Triple[Any, Any, Any] = {
val res = readf(format)
- Triple(res.head, res.tail.head, res.tail.tail.head)
+ {res.head, res.tail.head, res.tail.tail.head}
}
private def textComponents(a: Array[AnyRef]): List[Any] = {
diff --git a/src/library/scala/Iterator.scala b/src/library/scala/Iterator.scala
index 1ebd4c5c0d..a4f2c27c25 100644
--- a/src/library/scala/Iterator.scala
+++ b/src/library/scala/Iterator.scala
@@ -347,9 +347,9 @@ trait Iterator[+A] {
* and <code>b<sub>i</sub></code> are the elements from iterator
* <code>that</code>.
*/
- def zip[B](that: Iterator[B]) = new Iterator[Pair[A, B]] {
+ def zip[B](that: Iterator[B]) = new Iterator[{A, B}] {
def hasNext = Iterator.this.hasNext && that.hasNext
- def next = Pair(Iterator.this.next, that.next)
+ def next = {Iterator.this.next, that.next}
}
/** Return an iterator that pairs each element of this iterator
@@ -360,11 +360,11 @@ trait Iterator[+A] {
* {a<sub>1</sub>,1}...</code> where <code>a<sub>i</sub></code>
* are the elements from this iterator.
*/
- def zipWithIndex = new Iterator[Pair[A, int]] {
+ def zipWithIndex = new Iterator[{A, int}] {
var idx = 0
def hasNext = Iterator.this.hasNext
def next = {
- val ret = Pair(Iterator.this.next, idx)
+ val ret = {Iterator.this.next, idx}
idx = idx + 1
ret
}
@@ -540,7 +540,7 @@ trait Iterator[+A] {
*
* @return a pair of iterators
*/
- def duplicate: Pair[Iterator[A], Iterator[A]] = {
+ def duplicate: {Iterator[A], Iterator[A]} = {
var xs: List[A] = Nil
var ahead: Iterator[A] = null
class Partner extends Iterator[A] {
@@ -570,7 +570,7 @@ trait Iterator[+A] {
}
}
ahead = new Partner
- Pair(ahead, new Partner)
+ {ahead, new Partner}
}
/** Fills the given array <code>xs</code> with the elements of
diff --git a/src/library/scala/List.scala b/src/library/scala/List.scala
index 1d4716d4a4..25b7032ca9 100644
--- a/src/library/scala/List.scala
+++ b/src/library/scala/List.scala
@@ -140,7 +140,7 @@ object List {
* @param xs the list of pairs to unzip
* @return a pair of lists: the first list in the pair contains the list
*/
- def unzip[a,b](xs: List[Pair[a,b]]): Pair[List[a], List[b]] = {
+ def unzip[a,b](xs: List[{a,b}]): {List[a], List[b]} = {
val b1 = new ListBuffer[a]
val b2 = new ListBuffer[b]
var xc = xs
@@ -149,7 +149,7 @@ object List {
b2 += xc.head._2
xc = xc.tail
}
- Pair(b1.toList, b2.toList)
+ {b1.toList, b2.toList}
}
/** Converts an iterator to a list
@@ -590,7 +590,7 @@ sealed abstract class List[+a] extends Seq[a] {
* @return a pair of lists composed of the first <code>n</code>
* elements, and the other elements.
*/
- def splitAt(n: Int): Pair[List[a], List[a]] = {
+ def splitAt(n: Int): {List[a], List[a]} = {
val b = new ListBuffer[a]
var i = 0
var these = this
@@ -599,7 +599,7 @@ sealed abstract class List[+a] extends Seq[a] {
b += these.head
these = these.tail
}
- Pair(b.toList, these)
+ {b.toList, these}
}
/** Returns the longest prefix of this list whose elements satisfy
@@ -637,19 +637,19 @@ sealed abstract class List[+a] extends Seq[a] {
* @return a pair consisting of the longest prefix of the list whose
* elements all satisfy <code>p</code>, and the rest of the list.
*/
- def span(p: a => Boolean): Pair[List[a], List[a]] = {
+ def span(p: a => Boolean): {List[a], List[a]} = {
val b = new ListBuffer[a]
var these = this
while (!these.isEmpty && p(these.head)) {
b += these.head
these = these.tail
}
- Pair(b.toList, these)
+ {b.toList, these}
}
/** Like <code>span</code> but with the predicate inverted.
*/
- def break(p: a => Boolean): Pair[List[a], List[a]] = span { x => !p(x) }
+ def break(p: a => Boolean): {List[a], List[a]} = span { x => !p(x) }
/** Returns the <code>n</code>-th element of this list. The first element
* (head of the list) is at position 0.
@@ -752,7 +752,7 @@ sealed abstract class List[+a] extends Seq[a] {
* The relative order of the elements in the sub-lists is the
* same as in the original list.
*/
- def partition(p: a => Boolean): Pair[List[a], List[a]] = {
+ def partition(p: a => Boolean): {List[a], List[a]} = {
val btrue = new ListBuffer[a]
val bfalse = new ListBuffer[a]
var these = this
@@ -760,7 +760,7 @@ sealed abstract class List[+a] extends Seq[a] {
(if (p(these.head)) btrue else bfalse) += these.head
these = these.tail
}
- Pair(btrue.toList, bfalse.toList)
+ {btrue.toList, bfalse.toList}
}
/** <p>
@@ -804,7 +804,7 @@ sealed abstract class List[+a] extends Seq[a] {
else y::z::x::acc
case hd1::hd2::hd3::tail => {
val List(x, y, z) = sort_1(hd1::hd2::hd3::Nil, Nil)
- val Pair(small, large) = tail.partition((e2) => lt(e2, y))
+ val {small, large} = tail.partition((e2) => lt(e2, y))
sort_1(x::small, y::sort_1(z::large, acc))
}
}
@@ -828,7 +828,7 @@ sealed abstract class List[+a] extends Seq[a] {
else y::z::x::Nil
case hd1::hd2::hd3::tail => {
val List(x, y, z) = sort_1(hd1::hd2::hd3::Nil, Nil)
- val Pair(small,large) = tail.partition((e2) => lt(e2, y))
+ val {small,large} = tail.partition((e2) => lt(e2, y))
sort_1(x::small, y::sort_1(z::large, Nil));
}
}
@@ -999,12 +999,12 @@ sealed abstract class List[+a] extends Seq[a] {
* <code>List(a<sub>0</sub>, ..., a<sub>m</sub>)
* zip List(b<sub>0</sub>, ..., b<sub>n</sub>)</code> is invoked.
*/
- def zip[b](that: List[b]): List[Pair[a,b]] = {
- val b = new ListBuffer[Pair[a, b]]
+ def zip[b](that: List[b]): List[{a,b}] = {
+ val b = new ListBuffer[{a, b}]
var these = this
var those = that
while (!these.isEmpty && !those.isEmpty) {
- b += Pair(these.head, those.head)
+ b += {these.head, those.head}
these = these.tail
those = those.tail
}
@@ -1018,12 +1018,12 @@ sealed abstract class List[+a] extends Seq[a] {
* where <code>a<sub>i</sub></code> are the elements of this list.
*/
def zipWithIndex = {
- val b = new ListBuffer[Pair[a,int]]
+ val b = new ListBuffer[{a,int}]
var these = this
var idx = 0
while(!these.isEmpty) {
- b += Pair(these.head, idx)
+ b += {these.head, idx}
these = these.tail
idx = idx + 1
}
@@ -1050,21 +1050,21 @@ sealed abstract class List[+a] extends Seq[a] {
* [b<sub>0</sub>, ..., b<sub>m</sub>]</code> is
* invoked where <code>m &gt; n</code>.
*/
- def zipAll[b, c >: a, d >: b](that: List[b], thisElem: c, thatElem: d): List[Pair[c,d]] = {
- val b = new ListBuffer[Pair[c, d]]
+ def zipAll[b, c >: a, d >: b](that: List[b], thisElem: c, thatElem: d): List[{c,d}] = {
+ val b = new ListBuffer[{c, d}]
var these = this
var those = that
while (!these.isEmpty && !those.isEmpty) {
- b += Pair(these.head, those.head)
+ b += {these.head, those.head}
these = these.tail
those = those.tail
}
while (!these.isEmpty) {
- b += Pair(these.head, thatElem)
+ b += {these.head, thatElem}
these = these.tail
}
while (!those.isEmpty) {
- b += Pair(thisElem, those.head)
+ b += {thisElem, those.head}
those = those.tail
}
b.toList
diff --git a/src/library/scala/Stream.scala b/src/library/scala/Stream.scala
index 2e21fc27c1..0c55bcbb16 100644
--- a/src/library/scala/Stream.scala
+++ b/src/library/scala/Stream.scala
@@ -57,7 +57,7 @@ object Stream {
if(str.isEmpty)
None
else
- Some({str.head, str.tail})
+ Some{str.head, str.tail}
}
/** A stream containing all elements of a given iterator, in the order they are produced.
diff --git a/src/library/scala/collection/Map.scala b/src/library/scala/collection/Map.scala
index c02c195086..45f45a110b 100644
--- a/src/library/scala/collection/Map.scala
+++ b/src/library/scala/collection/Map.scala
@@ -35,7 +35,7 @@ import Predef._
* @author Martin Odersky
* @version 1.2, 31/12/2006
*/
-trait Map[A, +B] extends PartialFunction[A, B] with Iterable[Pair[A, B]] {
+trait Map[A, +B] extends PartialFunction[A, B] with Iterable[{A, B}] {
/** Compute the number of key-to-value mappings.
*
@@ -125,7 +125,7 @@ trait Map[A, +B] extends PartialFunction[A, B] with Iterable[Pair[A, B]] {
override def equals(that: Any): Boolean = that match {
case other: Map[a, b] =>
this.size == other.size && this.elements.forall {
- case Pair(key, value) => other.get(key.asInstanceOf[a]) match {
+ case {key, value} => other.get(key.asInstanceOf[a]) match {
case None => false
case Some(otherval) => value == otherval
}
diff --git a/src/library/scala/collection/MapProxy.scala b/src/library/scala/collection/MapProxy.scala
index 2585f24c7d..142d2c5ba0 100644
--- a/src/library/scala/collection/MapProxy.scala
+++ b/src/library/scala/collection/MapProxy.scala
@@ -20,7 +20,7 @@ package scala.collection
* @author Matthias Zenger
* @version 1.0, 21/07/2003
*/
-trait MapProxy[A, +B] extends Map[A, B] with IterableProxy[Pair[A, B]] {
+trait MapProxy[A, +B] extends Map[A, B] with IterableProxy[{A, B}] {
def self: Map[A, B]
diff --git a/src/library/scala/collection/immutable/HashMap.scala b/src/library/scala/collection/immutable/HashMap.scala
index b11f76dcb9..3cda6cf08b 100755
--- a/src/library/scala/collection/immutable/HashMap.scala
+++ b/src/library/scala/collection/immutable/HashMap.scala
@@ -37,7 +37,7 @@ class HashMap[A, B] extends Map[A,B] with mutable.HashTable[A] {
protected var oldValue: Option[B] = _
protected var deltaSize: int = _
- def empty[C] = new EmptyMap[A, C]
+ def empty[C]: Map[A, C] = new EmptyMap[A, C]
def get(key: A): Option[B] = {
var m = this
diff --git a/src/library/scala/collection/immutable/ListMap.scala b/src/library/scala/collection/immutable/ListMap.scala
index 1705378846..006bf9d49f 100644
--- a/src/library/scala/collection/immutable/ListMap.scala
+++ b/src/library/scala/collection/immutable/ListMap.scala
@@ -24,7 +24,7 @@ object ListMap {
/** The canonical factory for this type
*/
- def apply[A, B](elems: Pair[A, B]*) = empty[A, B] ++ elems
+ def apply[A, B](elems: {A, B}*) = empty[A, B] ++ elems
}
/** This class implements immutable maps using a list-based data
@@ -79,13 +79,13 @@ class ListMap[A, +B] extends Map[A, B] {
/** Returns an iterator over key-value pairs.
*/
- def elements: Iterator[Pair[A,B]] =
- new Iterator[Pair[A,B]] {
+ def elements: Iterator[{A,B}] =
+ new Iterator[{A,B}] {
var self: ListMap[A,B] = ListMap.this
def hasNext = !self.isEmpty
- def next: Pair[A,B] =
+ def next: {A,B} =
if (!hasNext) throw new NoSuchElementException("next on empty iterator")
- else { val res = Pair(self.key, self.value); self = self.next; res }
+ else { val res = {self.key, self.value}; self = self.next; res }
}.toList.reverse.elements
protected def key: A = throw new NoSuchElementException("empty map")
diff --git a/src/library/scala/collection/immutable/Map.scala b/src/library/scala/collection/immutable/Map.scala
index ef056e75f5..65fd32379f 100644
--- a/src/library/scala/collection/immutable/Map.scala
+++ b/src/library/scala/collection/immutable/Map.scala
@@ -37,11 +37,11 @@ import Predef._
object Map {
/** The empty map of this type; this is implemented as a treemap */
- def empty[A, B] = new EmptyMap[A, B]
+ def empty[A, B]: Map[A, B] = new EmptyMap[A, B]
/** The canonical factory for this type
*/
- def apply[A, B](elems: Pair[A, B]*) = empty[A, B] ++ elems
+ def apply[A, B](elems: {A, B}*) = empty[A, B] ++ elems
}
trait Map[A, +B] extends collection.Map[A, B] {
@@ -68,7 +68,7 @@ trait Map[A, +B] extends collection.Map[A, B] {
* @param kv the key/value pair.
* @return A new map with the new binding added to this map
*/
- def + [B1 >: B] (kv: Pair[A, B1]): Map[A, B1] = update(kv._1, kv._2)
+ def + [B1 >: B] (kv: {A, B1}): Map[A, B1] = update(kv._1, kv._2)
/** Add two or more key/value pairs to this map.
* @param kv1 the first key/value pair.
@@ -76,21 +76,21 @@ trait Map[A, +B] extends collection.Map[A, B] {
* @param kvs the remaining key/value pairs.
* @return A new map with the new bindings added
*/
- def + [B1 >: B] (kv1: Pair[A, B1], kv2: Pair[A, B1], kvs: Pair[A, B1]*): Map[A, B1] =
+ def + [B1 >: B] (kv1: {A, B1}, kv2: {A, B1}, kvs: {A, B1}*): Map[A, B1] =
this + kv1 + kv2 ++ kvs
/** Add a sequence of key/value pairs to this map.
* @param kvs the iterable object containing all key/value pairs.
* @return A new map with the new bindings added
*/
- def ++ [B1 >: B] (kvs: Iterable[Pair[A, B1]]): Map[A, B1] =
+ def ++ [B1 >: B] (kvs: Iterable[{A, B1}]): Map[A, B1] =
((this: Map[A, B1]) /: kvs) ((m, kv) => m + kv)
/** Add a sequence of key/value pairs to this map.
* @param kvs the iterator containing all key/value pairs.
* @return A new map with the new bindings added
*/
- def ++ [B1 >: B] (kvs: Iterator[Pair[A, B1]]): Map[A, B1] =
+ def ++ [B1 >: B] (kvs: Iterator[{A, B1}]): Map[A, B1] =
((this: Map[A, B1]) /: kvs) ((m, kv) => m + kv)
/** Remove a key from this map
@@ -140,7 +140,7 @@ trait Map[A, +B] extends collection.Map[A, B] {
*/
def transform[C](f: (A, B) => C): Map[A, C] = {
var res = empty[C]
- foreach { case Pair(key, value) => res = res.update(key, f(key, value)) }
+ foreach { case {key, value} => res = res.update(key, f(key, value)) }
res
}
@@ -150,10 +150,10 @@ trait Map[A, +B] extends collection.Map[A, B] {
* @param p A prediacte over key-value pairs
* @return the updated map
*/
- override def filter(p: Pair[A, B] => Boolean): Map[A, B] = {
+ override def filter(p: {A, B} => Boolean): Map[A, B] = {
var res = this
foreach {
- case kv @ Pair(key, _) => if (!p(kv)) { res = res - key }
+ case kv @ {key, _} => if (!p(kv)) { res = res - key }
}
res
}
@@ -178,7 +178,7 @@ trait Map[A, +B] extends collection.Map[A, B] {
* @return ...
* @deprecated use <code>+</code> instead
*/
- [deprecated] def incl[B1 >: B](mappings: Pair[A, B1]*): Map[A, B1] = incl(mappings)
+ [deprecated] def incl[B1 >: B](mappings: {A, B1}*): Map[A, B1] = incl(mappings)
/** <code>incl</code> can be used to add many mappings at the same time
* to the map. The method assumes that each mapping is represented
@@ -187,11 +187,11 @@ trait Map[A, +B] extends collection.Map[A, B] {
*
* @deprecated use <code>++</code> instead
*/
- [deprecated] def incl[B1 >: B](map: Iterable[Pair[A, B1]]): Map[A, B1] = {
+ [deprecated] def incl[B1 >: B](map: Iterable[{A, B1}]): Map[A, B1] = {
val iter = map.elements
var res: Map[A, B1] = this
while (iter.hasNext) {
- val Pair(key, value) = iter.next
+ val {key, value} = iter.next
res = res.update(key, value);
}
res
@@ -227,7 +227,7 @@ trait Map[A, +B] extends collection.Map[A, B] {
* @param p ...
* @return the string representation of a map entry
*/
- [deprecated] def mappingToString[B1 >: B](p: Pair[A, B1]) = p._1.toString() + " -> " + p._2
+ [deprecated] def mappingToString[B1 >: B](p: {A, B1}) = p._1.toString() + " -> " + p._2
/** @deprecated use <code>+({A, B})</code> instead
*/
diff --git a/src/library/scala/collection/immutable/Map1.scala b/src/library/scala/collection/immutable/Map1.scala
index 8310d40e7c..22a2e05b09 100755
--- a/src/library/scala/collection/immutable/Map1.scala
+++ b/src/library/scala/collection/immutable/Map1.scala
@@ -26,7 +26,7 @@ class Map1[A, +B](key1: A, value1: B) extends Map[A, B] {
def elements = Iterator.single({key1, value1})
- def empty[B] = new EmptyMap[A, B]
+ def empty[B]: Map[A, B] = new EmptyMap[A, B]
def update [B1 >: B](key: A, value: B1): Map[A, B1] =
if (key == key1) new Map1(key1, value)
diff --git a/src/library/scala/collection/immutable/Map2.scala b/src/library/scala/collection/immutable/Map2.scala
index 6082ca293b..fbadfaa68d 100755
--- a/src/library/scala/collection/immutable/Map2.scala
+++ b/src/library/scala/collection/immutable/Map2.scala
@@ -29,7 +29,7 @@ class Map2[A, +B](key1: A, value1: B, key2: A, value2: B) extends Map[A, B] {
def elements = Iterator.fromValues(
{key1, value1}, {key2, value2})
- def empty[C] = new EmptyMap[A, C]
+ def empty[C]: Map[A, C] = new EmptyMap[A, C]
def update [B1 >: B](key: A, value: B1): Map[A, B1] =
if (key == key1) new Map2(key1, value, key2, value2)
diff --git a/src/library/scala/collection/immutable/Map3.scala b/src/library/scala/collection/immutable/Map3.scala
index e2320f55f5..38198bbc71 100755
--- a/src/library/scala/collection/immutable/Map3.scala
+++ b/src/library/scala/collection/immutable/Map3.scala
@@ -30,7 +30,7 @@ class Map3[A, +B](key1: A, value1: B, key2: A, value2: B, key3: A, value3: B) ex
def elements = Iterator.fromValues(
{key1, value1}, {key2, value2}, {key3, value3})
- def empty[C] = new EmptyMap[A, C]
+ def empty[C]: Map[A, C] = new EmptyMap[A, C]
def update [B1 >: B](key: A, value: B1): Map[A, B1] =
if (key == key1) new Map3(key1, value, key2, value2, key3, value3)
diff --git a/src/library/scala/collection/immutable/Map4.scala b/src/library/scala/collection/immutable/Map4.scala
index fa45f53b41..3596008109 100755
--- a/src/library/scala/collection/immutable/Map4.scala
+++ b/src/library/scala/collection/immutable/Map4.scala
@@ -31,7 +31,7 @@ class Map4[A, +B](key1: A, value1: B, key2: A, value2: B, key3: A, value3: B, ke
def elements = Iterator.fromValues(
{key1, value1}, {key2, value2}, {key3, value3}, {key4, value4})
- def empty[C] = new EmptyMap[A, C]
+ def empty[C]: Map[A, C] = new EmptyMap[A, C]
def update [B1 >: B](key: A, value: B1): Map[A, B1] =
if (key == key1) new Map4(key1, value, key2, value2, key3, value3, key4, value4)
diff --git a/src/library/scala/collection/immutable/Queue.scala b/src/library/scala/collection/immutable/Queue.scala
index e63492592c..c88bbbdb27 100644
--- a/src/library/scala/collection/immutable/Queue.scala
+++ b/src/library/scala/collection/immutable/Queue.scala
@@ -100,12 +100,12 @@ class Queue[+A](elem: A*) extends Seq[A] {
* @throws Predef.NoSuchElementException
* @return the first element of the queue.
*/
- def dequeue: Pair[A, Queue[A]] = {
- val Pair(newOut, newIn) =
- if (out.isEmpty) Pair(in.reverse, Nil)
- else Pair(out, in);
+ def dequeue: {A, Queue[A]} = {
+ val {newOut, newIn} =
+ if (out.isEmpty) {in.reverse, Nil}
+ else {out, in};
if (newOut.isEmpty) throw new NoSuchElementException("queue empty")
- else Pair(newOut.head, mkQueue(newIn, newOut.tail))
+ else {newOut.head, mkQueue(newIn, newOut.tail)}
}
/** Returns the first element in the queue, or throws an error if there
@@ -155,7 +155,7 @@ class Queue[+A](elem: A*) extends Seq[A] {
override def hashCode(): Int =
if (isEmpty) 0
else {
- val q: Pair[A,Queue[A]] = dequeue;
+ val q: {A,Queue[A]} = dequeue;
q._1.hashCode() + q._2.hashCode()
}
}
diff --git a/src/library/scala/collection/immutable/RedBlack.scala b/src/library/scala/collection/immutable/RedBlack.scala
index dd3c7ebc94..cd0fd432f9 100755
--- a/src/library/scala/collection/immutable/RedBlack.scala
+++ b/src/library/scala/collection/immutable/RedBlack.scala
@@ -19,7 +19,7 @@ abstract class RedBlack[A] {
def lookup(x: A): Tree[B]
def update[B1 >: B](k: A, v: B1): Tree[B1] = blacken(upd(k, v))
def delete(k: A): Tree[B] = del(k)
- def elements: Iterator[Pair[A, B]]
+ def elements: Iterator[{A, B}]
def upd[B1 >: B](k: A, v: B1): Tree[B1]
def del(k: A): Tree[B]
def smallest: NonEmpty[B]
@@ -67,8 +67,8 @@ abstract class RedBlack[A] {
}
}
def smallest: NonEmpty[B] = if (left.isEmpty) this else left.smallest
- def elements: Iterator[Pair[A, B]] =
- left.elements append Iterator.single(Pair(key, value)) append right.elements
+ def elements: Iterator[{A, B}] =
+ left.elements append Iterator.single({key, value}) append right.elements
}
[serializable]
case object Empty extends Tree[Nothing] {
@@ -78,7 +78,7 @@ abstract class RedBlack[A] {
def upd[B](k: A, v: B): Tree[B] = RedTree(k, v, Empty, Empty)
def del(k: A): Tree[Nothing] = this
def smallest: NonEmpty[Nothing] = throw new NoSuchElementException("empty map")
- def elements: Iterator[Pair[A, Nothing]] = Iterator.empty
+ def elements: Iterator[{A, Nothing}] = Iterator.empty
}
[serializable]
case class RedTree[+B](override val key: A,
diff --git a/src/library/scala/collection/immutable/Set.scala b/src/library/scala/collection/immutable/Set.scala
index 1e80023199..4aa51755c4 100644
--- a/src/library/scala/collection/immutable/Set.scala
+++ b/src/library/scala/collection/immutable/Set.scala
@@ -28,7 +28,7 @@ package scala.collection.immutable
object Set {
/** The empty set of this type
*/
- def empty[A] = new EmptySet[A]
+ def empty[A]: Set[A] = new EmptySet[A]
/** The canonical factory for this type
*/
diff --git a/src/library/scala/collection/immutable/Tree.scala b/src/library/scala/collection/immutable/Tree.scala
index eef8842e39..bc69b7c4db 100644
--- a/src/library/scala/collection/immutable/Tree.scala
+++ b/src/library/scala/collection/immutable/Tree.scala
@@ -235,7 +235,7 @@ private case class INode[A <% Ordered[A],B](t1: GBTree[A,B],
def insertRight(key: A, value: B, smaller: GBTree[A,B]) =
balance_p(GBNode(key, value, smaller, t1),smaller);
protected def balance_p(t:GBTree[A,B],subtree:GBTree[A,B]):InsertTree[A,B] = {
- val Pair(subHeight, subSize) = subtree.count
+ val {subHeight, subSize} = subtree.count
val totalHeight = 2 * compat.Math.max(height, subHeight)
val totalSize = size + subSize + 1
val BalanceHeight = totalSize * totalSize
@@ -260,13 +260,13 @@ protected abstract class GBTree[A <% Ordered[A],B] extends AnyRef {
/** Calculates 2^h, and size, where h is the height of the tree
* and size is the number of nodes in the tree.
*/
- def count: Pair[Int,Int]
+ def count: {Int,Int}
def isDefinedAt(Key: A): Boolean
def get(key: A): Option[B]
def apply(key: A): B
def update(key: A, value: B): aNode
def insert(key: A, value: B, size: Int): anInsertTree
- def toList(acc: List[Pair[A,B]]): List[Pair[A,B]]
+ def toList(acc: List[{A,B}]): List[{A,B}]
def mk_iter(iter_tail: List[aNode]): List[aNode]
def delete(key: A): aNode
def merge(t: aNode): aNode
@@ -275,7 +275,7 @@ protected abstract class GBTree[A <% Ordered[A],B] extends AnyRef {
}
private case class GBLeaf[A <% Ordered[A],B]() extends GBTree[A,B] {
- def count = Pair(1, 0)
+ def count = {1, 0}
def isDefinedAt(key: A) = false
def get(_key: A) = None
def apply(key: A) = throw new NoSuchElementException("key " + key + " not found")
@@ -286,7 +286,7 @@ private case class GBLeaf[A <% Ordered[A],B]() extends GBTree[A,B] {
else
ITree(GBNode(key, value, this, this))
}
- def toList(acc: List[Pair[A,B]]): List[Pair[A,B]] = acc
+ def toList(acc: List[{A,B}]): List[{A,B}] = acc
def mk_iter(iter_tail: List[GBTree[A,B]]) = iter_tail
def merge(larger: GBTree[A,B]) = larger
def takeSmallest: Triple[A,B, GBTree[A,B]] =
@@ -301,14 +301,14 @@ private case class GBNode[A <% Ordered[A],B](key: A,
smaller: GBTree[A,B],
bigger: GBTree[A,B])
extends GBTree[A,B] {
- def count: Pair[Int,Int] = {
- val Pair(sHeight, sSize) = smaller.count
- val Pair(bHeight, bSize) = bigger.count
+ def count: {Int,Int} = {
+ val {sHeight, sSize} = smaller.count
+ val {bHeight, bSize} = bigger.count
val mySize = sSize + bSize + 1
if (mySize == 1)
- Pair(1, mySize)
+ {1, mySize}
else
- Pair(2 * compat.Math.max(sHeight, bHeight), mySize)
+ {2 * compat.Math.max(sHeight, bHeight), mySize}
}
def isDefinedAt(sKey: A): Boolean =
@@ -343,8 +343,8 @@ private case class GBNode[A <% Ordered[A],B](key: A,
throw new NoSuchElementException("Key exists: " + newKey)
}
- def toList(acc: List[Pair[A,B]]): List[Pair[A,B]] =
- smaller.toList(Pair(key, value) :: bigger.toList(acc))
+ def toList(acc: List[{A,B}]): List[{A,B}] =
+ smaller.toList({key, value} :: bigger.toList(acc))
def mk_iter(iter_tail:List[aNode]):List[aNode] =
smaller.mk_iter(this :: iter_tail)
@@ -362,16 +362,16 @@ private case class GBNode[A <% Ordered[A],B](key: A,
case GBLeaf() =>
this
case _ =>
- val Triple(key1, value1, larger1) = larger.takeSmallest
+ val {key1, value1, larger1} = larger.takeSmallest
GBNode(key1, value1, this, larger1)
}
def takeSmallest: Triple[A, B, aNode] = smaller match {
case GBLeaf() =>
- Triple(key, value, bigger)
+ {key, value, bigger}
case _ =>
- val Triple(key1, value1, smaller1) = smaller.takeSmallest
- Triple(key1, value1, GBNode(key, value, smaller1, bigger))
+ val {key1, value1, smaller1} = smaller.takeSmallest
+ {key1, value1, GBNode(key, value, smaller1, bigger)}
}
/**
@@ -381,22 +381,22 @@ private case class GBNode[A <% Ordered[A],B](key: A,
def balance(s: int): GBTree[A,B] =
balance_list(toList(scala.Nil), s)
- protected def balance_list(list: List[Pair[A,B]], s: int): GBTree[A,B] = {
+ protected def balance_list(list: List[{A,B}], s: int): GBTree[A,B] = {
val empty = GBLeaf[A,B]();
- def bal(list: List[Pair[A,B]], s: Int): Pair[aNode, List[Pair[A,B]]] = {
+ def bal(list: List[{A,B}], s: Int): {aNode, List[{A,B}]} = {
if (s > 1) {
val sm = s - 1
val s2 = sm / 2
val s1 = sm - s2
- val Pair(t1, Pair(k, v) :: l1) = bal(list, s1)
- val Pair(t2, l2) = bal(l1, s2)
+ val {t1, {k, v} :: l1} = bal(list, s1)
+ val {t2, l2} = bal(l1, s2)
val t = GBNode(k, v, t1, t2)
- Pair(t, l2)
+ {t, l2}
} else if (s == 1) {
- val Pair(k,v) :: rest = list
- Pair(GBNode(k, v, empty, empty), rest)
+ val {k,v} :: rest = list
+ {GBNode(k, v, empty, empty), rest}
} else
- Pair(empty, list)
+ {empty, list}
}
bal(list, s)._1
}
diff --git a/src/library/scala/collection/immutable/TreeMap.scala b/src/library/scala/collection/immutable/TreeMap.scala
index 9e43f092df..22664f1e20 100644
--- a/src/library/scala/collection/immutable/TreeMap.scala
+++ b/src/library/scala/collection/immutable/TreeMap.scala
@@ -25,7 +25,7 @@ object TreeMap {
/** The canonical factory for this type
*/
- def apply[A <% Ordered[A], B](elems: Pair[A, B]*) = empty[A, B] ++ elems
+ def apply[A <% Ordered[A], B](elems: {A, B}*) = empty[A, B] ++ elems
}
/** This class implements immutable maps using a tree.
@@ -104,7 +104,7 @@ extends RedBlack[A] with Map[A, B] {
*
* @return the new iterator
*/
- def elements: Iterator[Pair[A, B]] = tree.elements
+ def elements: Iterator[{A, B}] = tree.elements
}
diff --git a/src/library/scala/collection/immutable/UnbalancedTreeMap.scala b/src/library/scala/collection/immutable/UnbalancedTreeMap.scala
index 965c4729c6..dabc3a11cf 100755
--- a/src/library/scala/collection/immutable/UnbalancedTreeMap.scala
+++ b/src/library/scala/collection/immutable/UnbalancedTreeMap.scala
@@ -20,7 +20,7 @@ object UnbalancedTreeMap {
/** The canonical factory for this type
*/
- def apply[A<% Ordered[A], B](elems: Pair[A, B]*) = empty[A, B] ++ elems
+ def apply[A<% Ordered[A], B](elems: {A, B}*) = empty[A, B] ++ elems
}
/** This class implements immutable maps using a tree.
@@ -95,7 +95,7 @@ class UnbalancedTreeMap[A <% Ordered[A], +B] extends Map[A, B] {
*
* @return the new iterator
*/
- def elements: Iterator[Pair[A, B]] = Iterator.empty
+ def elements: Iterator[{A, B}] = Iterator.empty
protected class Node[+B](override protected val key: A,
override protected val value: B,
@@ -133,8 +133,8 @@ class UnbalancedTreeMap[A <% Ordered[A], +B] extends Map[A, B] {
}
}
- override def elements: Iterator[Pair[A, B]] =
- left.elements append Iterator.single(Pair(key, value)) append right.elements
+ override def elements: Iterator[{A, B}] =
+ left.elements append Iterator.single({key, value}) append right.elements
}
}
diff --git a/src/library/scala/collection/mutable/ArrayBuffer.scala b/src/library/scala/collection/mutable/ArrayBuffer.scala
index f840fc3a2a..e506e95994 100644
--- a/src/library/scala/collection/mutable/ArrayBuffer.scala
+++ b/src/library/scala/collection/mutable/ArrayBuffer.scala
@@ -166,7 +166,7 @@ class ArrayBuffer[A] extends Buffer[A] with ResizableArray[A] {
case that: ArrayBuffer[_] =>
this.length == that.length &&
elements.zip(that.elements).forall {
- case Pair(thiselem, thatelem) => thiselem == thatelem
+ case {thiselem, thatelem} => thiselem == thatelem
}
case _ =>
false
diff --git a/src/library/scala/collection/mutable/Buffer.scala b/src/library/scala/collection/mutable/Buffer.scala
index 5d8f24393c..fac9603438 100644
--- a/src/library/scala/collection/mutable/Buffer.scala
+++ b/src/library/scala/collection/mutable/Buffer.scala
@@ -25,7 +25,7 @@ import Predef._
[cloneable]
trait Buffer[A] extends AnyRef
with Seq[A]
- with Scriptable[Message[Pair[Location, A]]]
+ with Scriptable[Message[{Location, A}]]
{
/** Append a single element to this buffer.
@@ -202,20 +202,20 @@ trait Buffer[A] extends AnyRef
*
* @param cmd the message to send.
*/
- def <<(cmd: Message[Pair[Location, A]]): Unit = cmd match {
- case Include(Pair(l, elem)) => l match {
+ def <<(cmd: Message[{Location, A}]): Unit = cmd match {
+ case Include({l, elem}) => l match {
case Start => prepend(elem)
case End => append(elem)
case Index(n) => insert(n, elem)
case _ => throw new UnsupportedOperationException("message " + cmd + " not understood")
}
- case Update(Pair(l, elem)) => l match {
+ case Update({l, elem}) => l match {
case Start => update(0, elem)
case End => update(length - 1, elem)
case Index(n) => update(n, elem)
case _ => throw new UnsupportedOperationException("message " + cmd + " not understood")
}
- case Remove(Pair(l, _)) => l match {
+ case Remove({l, _}) => l match {
case Start => remove(0)
case End => remove(length - 1)
case Index(n) => remove(n)
diff --git a/src/library/scala/collection/mutable/BufferProxy.scala b/src/library/scala/collection/mutable/BufferProxy.scala
index 5f1d60e333..adf7162954 100644
--- a/src/library/scala/collection/mutable/BufferProxy.scala
+++ b/src/library/scala/collection/mutable/BufferProxy.scala
@@ -142,7 +142,7 @@ trait BufferProxy[A] extends Buffer[A] with Proxy {
*
* @param cmd the message to send.
*/
- override def <<(cmd: Message[Pair[Location, A]]): Unit = self << cmd
+ override def <<(cmd: Message[{Location, A}]): Unit = self << cmd
/** Return a clone of this buffer.
*
diff --git a/src/library/scala/collection/mutable/HashMap.scala b/src/library/scala/collection/mutable/HashMap.scala
index 863a535aef..59a8b8a860 100644
--- a/src/library/scala/collection/mutable/HashMap.scala
+++ b/src/library/scala/collection/mutable/HashMap.scala
@@ -26,7 +26,7 @@ object HashMap {
/** The canonical factory for this type
*/
- def apply[A, B](elems: Pair[A, B]*) = empty[A, B] ++ elems
+ def apply[A, B](elems: {A, B}*) = empty[A, B] ++ elems
}
[serializable]
diff --git a/src/library/scala/collection/mutable/History.scala b/src/library/scala/collection/mutable/History.scala
index 4143e6e9de..dbafbf29dc 100644
--- a/src/library/scala/collection/mutable/History.scala
+++ b/src/library/scala/collection/mutable/History.scala
@@ -21,9 +21,9 @@ package scala.collection.mutable
* @version 1.0, 08/07/2003
*/
[serializable]
-class History[A, B] extends AnyRef with Subscriber[A, B] with Iterable[Pair[B, A]] {
+class History[A, B] extends AnyRef with Subscriber[A, B] with Iterable[{B, A}] {
- protected val log: Queue[Pair[B, A]] = new Queue[Pair[B, A]]
+ protected val log: Queue[{B, A}] = new Queue[{B, A}]
val maxHistory: Int = 1000
@@ -35,12 +35,12 @@ class History[A, B] extends AnyRef with Subscriber[A, B] with Iterable[Pair[B, A
if (log.length >= maxHistory) {
val old = log.dequeue;
}
- log.enqueue(Pair(pub, event))
+ log.enqueue({pub, event})
}
- def elements: Iterator[Pair[B, A]] = log.elements
+ def elements: Iterator[{B, A}] = log.elements
- def events: Iterator[A] = log.elements.map { case Pair(_, e) => e }
+ def events: Iterator[A] = log.elements.map { case {_, e} => e }
def size: Int = log.length
diff --git a/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala b/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala
index 37bbb9dce4..9328f19629 100644
--- a/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala
+++ b/src/library/scala/collection/mutable/ImmutableMapAdaptor.scala
@@ -45,9 +45,9 @@ extends Map[A, B]
override def values: Iterator[B] = imap.values
- def elements: Iterator[Pair[A, B]] = imap.elements
+ def elements: Iterator[{A, B}] = imap.elements
- override def toList: List[Pair[A, B]] = imap.toList
+ override def toList: List[{A, B}] = imap.toList
def update(key: A, value: B): Unit = { imap = imap.update(key, value) }
diff --git a/src/library/scala/collection/mutable/JavaMapAdaptor.scala b/src/library/scala/collection/mutable/JavaMapAdaptor.scala
index 9b918836da..825758b64b 100644
--- a/src/library/scala/collection/mutable/JavaMapAdaptor.scala
+++ b/src/library/scala/collection/mutable/JavaMapAdaptor.scala
@@ -45,12 +45,12 @@ class JavaMapAdaptor[A, B](jmap: java.util.Map) extends Map[A, B] {
def next = iter.next().asInstanceOf[B]
}
- def elements: Iterator[Pair[A, B]] = new Iterator[Pair[A, B]] {
+ def elements: Iterator[{A, B}] = new Iterator[{A, B}] {
val iter = jmap.keySet().iterator()
def hasNext = iter.hasNext()
def next = {
val key = iter.next().asInstanceOf[A]
- Pair(key, apply(key))
+ {key, apply(key)}
}
}
diff --git a/src/library/scala/collection/mutable/ListBuffer.scala b/src/library/scala/collection/mutable/ListBuffer.scala
index 55bd75d3fd..2f4b95f55f 100644
--- a/src/library/scala/collection/mutable/ListBuffer.scala
+++ b/src/library/scala/collection/mutable/ListBuffer.scala
@@ -268,7 +268,7 @@ final class ListBuffer[A] extends Buffer[A] {
case that: ListBuffer[_] =>
(this.length == that.length &&
elements.zip(that.elements).forall {
- case Pair(thiselem, thatelem) => thiselem == thatelem
+ case {thiselem, thatelem} => thiselem == thatelem
})
case _ =>
false
diff --git a/src/library/scala/collection/mutable/Map.scala b/src/library/scala/collection/mutable/Map.scala
index ce7bdcabf0..8b0342e5d6 100644
--- a/src/library/scala/collection/mutable/Map.scala
+++ b/src/library/scala/collection/mutable/Map.scala
@@ -28,17 +28,17 @@ import Predef._
object Map {
/** The empty map of this type; this is implemented as a hashtable */
- def empty[A, B] = new HashMap[A, B]
+ def empty[A, B]: Map[A, B] = new HashMap[A, B]
/** The canonical factory for this type
*/
- def apply[A, B](elems: Pair[A, B]*) = empty[A, B] ++ elems
+ def apply[A, B](elems: {A, B}*) = empty[A, B] ++ elems
}
[cloneable]
trait Map[A, B] extends AnyRef
with collection.Map[A, B]
- with Scriptable[Message[Pair[A, B]]]
+ with Scriptable[Message[{A, B}]]
{
/** This method allows one to add a new mapping from <code>key</code>
* to <code>value</code> to the map. If the map already contains a
@@ -53,30 +53,30 @@ trait Map[A, B] extends AnyRef
/** Add a key/value pair to this map.
* @param kv the key/value pair.
*/
- def += (kv: Pair[A, B]) { update(kv._1, kv._2) }
+ def += (kv: {A, B}) { update(kv._1, kv._2) }
/** Add two or more key/value pairs to this map.
* @param kv1 the first key/value pair.
* @param kv2 the second key/value pair.
* @param kvs the remaining key/value pairs.
*/
- def += (kv1: Pair[A, B], kv2: Pair[A, B], kvs: Pair[A, B]*) { this += kv1; this += kv2; this ++= kvs }
+ def += (kv1: {A, B}, kv2: {A, B}, kvs: {A, B}*) { this += kv1; this += kv2; this ++= kvs }
/** Add a sequence of key/value pairs to this map.
* @param kvs the iterable object containing all key/value pairs.
*/
- def ++= (kvs: Iterable[Pair[A, B]]) { this ++= kvs.elements }
+ def ++= (kvs: Iterable[{A, B}]) { this ++= kvs.elements }
/** Add a sequence of key/value pairs to this map.
* @param kvs the iterator containing all key/value pairs.
*/
- def ++= (kvs: Iterator[Pair[A, B]]) { kvs foreach += }
+ def ++= (kvs: Iterator[{A, B}]) { kvs foreach += }
/** Add a key/value pair to this map.
* @param kv the key/value pair.
* @return The map itself with the new binding added in place.
*/
- def + (kv: Pair[A, B]): Map[A, B] = { this += kv; this }
+ def + (kv: {A, B}): Map[A, B] = { this += kv; this }
/** Add two or more key/value pairs to this map.
* @param kv1 the first key/value pair.
@@ -84,7 +84,7 @@ trait Map[A, B] extends AnyRef
* @param kvs the remaining key/value pairs.
* @return The map itself with the new bindings added in place.
*/
- def + (kv1: Pair[A, B], kv2: Pair[A, B], kvs: Pair[A, B]*): Map[A, B] = {
+ def + (kv1: {A, B}, kv2: {A, B}, kvs: {A, B}*): Map[A, B] = {
this.+=(kv1, kv2, kvs: _*); this
}
@@ -92,13 +92,13 @@ trait Map[A, B] extends AnyRef
* @param kvs the iterable object containing all key/value pairs.
* @return The itself map with the new bindings added in place.
*/
- def ++ (kvs: Iterable[Pair[A, B]]): Map[A, B] = { this ++= kvs; this }
+ def ++ (kvs: Iterable[{A, B}]): Map[A, B] = { this ++= kvs; this }
/** Add a sequence of key/value pairs to this map.
* @param kvs the iterator containing all key/value pairs.
* @return The itself map with the new bindings added in place.
*/
- def ++ (kvs: Iterator[Pair[A, B]]): Map[A, B] = { this ++= kvs; this }
+ def ++ (kvs: Iterator[{A, B}]): Map[A, B] = { this ++= kvs; this }
/** Remove a key from this map, noop if key is not present.
* @param key the key to be removed
@@ -161,7 +161,7 @@ trait Map[A, B] extends AnyRef
*/
def transform(f: (A, B) => B) {
elements foreach {
- case Pair(key, value) => update(key, f(key, value))
+ case {key, value} => update(key, f(key, value))
}
}
@@ -171,17 +171,17 @@ trait Map[A, B] extends AnyRef
* @param p The test predicate
*/
def retain(p: (A, B) => Boolean): Unit = toList foreach {
- case Pair(key, value) => if (!p(key, value)) -=(key)
+ case {key, value} => if (!p(key, value)) -=(key)
}
/** Send a message to this scriptable object.
*
* @param cmd the message to send.
*/
- def <<(cmd: Message[Pair[A, B]]): Unit = cmd match {
- case Include(Pair(k, v)) => update(k, v)
- case Update(Pair(k, v)) => update(k, v)
- case Remove(Pair(k, _)) => this -= k
+ def <<(cmd: Message[{A, B}]): Unit = cmd match {
+ case Include({k, v}) => update(k, v)
+ case Update({k, v}) => update(k, v)
+ case Remove({k, _}) => this -= k
case Reset() => clear
case s: Script[_] => s.elements foreach <<
case _ => throw new UnsupportedOperationException("message " + cmd + " not understood")
@@ -210,7 +210,7 @@ trait Map[A, B] extends AnyRef
* @param mappings
* @deprecated use <code>+=</code>
*/
- [deprecated] def incl(mappings: Pair[A, B]*): Unit = this ++= mappings.elements
+ [deprecated] def incl(mappings: {A, B}*): Unit = this ++= mappings.elements
/** This method will remove all the mappings for the given sequence
* of keys from the map.
@@ -226,9 +226,9 @@ trait Map[A, B] extends AnyRef
* @deprecated use retain instead
* @param p
*/
- [deprecated] override def filter(p: Pair[A, B] => Boolean): Iterable[Pair[A, B]] = {
+ [deprecated] override def filter(p: {A, B} => Boolean): Iterable[{A, B}] = {
toList foreach {
- case kv @ Pair(key, _) => if (!p(kv)) -=(key)
+ case kv @ {key, _} => if (!p(kv)) -=(key)
}
this
}
diff --git a/src/library/scala/collection/mutable/MapProxy.scala b/src/library/scala/collection/mutable/MapProxy.scala
index 431a9d5273..deea498609 100644
--- a/src/library/scala/collection/mutable/MapProxy.scala
+++ b/src/library/scala/collection/mutable/MapProxy.scala
@@ -30,14 +30,14 @@ trait MapProxy[A, B] extends Map[A, B] with collection.MapProxy[A, B] {
def self: Map[A, B]
override def update(key: A, value: B): Unit = self.update(key, value)
- override def += (kv: Pair[A, B]) = self += kv
- override def += (kv1: Pair[A, B], kv2: Pair[A, B], kvs: Pair[A, B]*) = self.+=(kv1, kv2, kvs: _*)
- override def ++= (kvs: Iterable[Pair[A, B]]) = self ++= kvs
- override def ++= (kvs: Iterator[Pair[A, B]]) = self ++= kvs
- override def + (kv: Pair[A, B]): Map[A, B] = self + kv
- override def + (kv1: Pair[A, B], kv2: Pair[A, B], kvs: Pair[A, B]*): Map[A, B] = self.+(kv1, kv2, kvs: _*)
- override def ++ (kvs: Iterable[Pair[A, B]]): Map[A, B] = self ++ kvs
- override def ++ (kvs: Iterator[Pair[A, B]]): Map[A, B] = self ++ kvs
+ override def += (kv: {A, B}) = self += kv
+ override def += (kv1: {A, B}, kv2: {A, B}, kvs: {A, B}*) = self.+=(kv1, kv2, kvs: _*)
+ override def ++= (kvs: Iterable[{A, B}]) = self ++= kvs
+ override def ++= (kvs: Iterator[{A, B}]) = self ++= kvs
+ override def + (kv: {A, B}): Map[A, B] = self + kv
+ override def + (kv1: {A, B}, kv2: {A, B}, kvs: {A, B}*): Map[A, B] = self.+(kv1, kv2, kvs: _*)
+ override def ++ (kvs: Iterable[{A, B}]): Map[A, B] = self ++ kvs
+ override def ++ (kvs: Iterator[{A, B}]): Map[A, B] = self ++ kvs
override def -= (key: A) = self -= key
override def -= (key1: A, key2: A, keys: A*) = self.-=(key1, key2, keys: _*)
override def --= (keys: Iterable[A]) = self --= keys
@@ -49,8 +49,8 @@ trait MapProxy[A, B] extends Map[A, B] with collection.MapProxy[A, B] {
override def clear(): Unit = self.clear
override def transform(f: (A, B) => B) = self transform f
override def retain(p: (A, B) => Boolean): Unit = self retain p
- override def <<(cmd: Message[Pair[A, B]]): Unit = self << cmd
+ override def <<(cmd: Message[{A, B}]): Unit = self << cmd
override def clone(): Map[A, B] = self.clone()
- [deprecated] override def incl(mappings: Pair[A, B]*): Unit = self.incl(mappings: _*)
+ [deprecated] override def incl(mappings: {A, B}*): Unit = self.incl(mappings: _*)
[deprecated] override def excl(keys: A*): Unit = self.excl(keys: _*)
}
diff --git a/src/library/scala/collection/mutable/ObservableBuffer.scala b/src/library/scala/collection/mutable/ObservableBuffer.scala
index 57f474f6e8..0aa15611a6 100644
--- a/src/library/scala/collection/mutable/ObservableBuffer.scala
+++ b/src/library/scala/collection/mutable/ObservableBuffer.scala
@@ -24,13 +24,13 @@ package scala.collection.mutable
*/
trait ObservableBuffer[A, This <: ObservableBuffer[A, This]] requires This
extends Buffer[A]
- with Publisher[Message[Pair[Location, A]]
+ with Publisher[Message[{Location, A}]
with Undoable, This]
{
abstract override def +(element: A): Buffer[A] = {
super.+(element)
- publish(new Include(Pair(End, element)) with Undoable {
+ publish(new Include({End, element}) with Undoable {
def undo: Unit = trimEnd(1)
})
this
@@ -38,7 +38,7 @@ trait ObservableBuffer[A, This <: ObservableBuffer[A, This]] requires This
abstract override def +:(element: A): Buffer[A] = {
super.+:(element);
- publish(new Include(Pair(Start, element)) with Undoable {
+ publish(new Include({Start, element}) with Undoable {
def undo: Unit = trimStart(1)
})
this
@@ -49,7 +49,7 @@ trait ObservableBuffer[A, This <: ObservableBuffer[A, This]] requires This
var i = n
val it = iter.elements
while (it.hasNext) {
- publish(new Include(Pair(Index(i), it.next)) with Undoable {
+ publish(new Include({Index(i), it.next}) with Undoable {
def undo: Unit = remove(i);
})
i = i + 1
@@ -59,7 +59,7 @@ trait ObservableBuffer[A, This <: ObservableBuffer[A, This]] requires This
abstract override def update(n: Int, newelement: A): Unit = {
val oldelement = apply(n)
super.update(n, newelement)
- publish(new Update(Pair(Index(n), newelement)) with Undoable {
+ publish(new Update({Index(n), newelement}) with Undoable {
def undo: Unit = update(n, oldelement)
})
}
@@ -67,7 +67,7 @@ trait ObservableBuffer[A, This <: ObservableBuffer[A, This]] requires This
abstract override def remove(n: Int): A = {
val oldelement = apply(n)
super.remove(n)
- publish(new Remove(Pair(Index(n), oldelement)) with Undoable {
+ publish(new Remove({Index(n), oldelement}) with Undoable {
def undo: Unit = insert(n, oldelement)
})
oldelement
diff --git a/src/library/scala/collection/mutable/ObservableMap.scala b/src/library/scala/collection/mutable/ObservableMap.scala
index 988eaf67c6..626129343c 100644
--- a/src/library/scala/collection/mutable/ObservableMap.scala
+++ b/src/library/scala/collection/mutable/ObservableMap.scala
@@ -23,19 +23,19 @@ package scala.collection.mutable
*/
trait ObservableMap[A, B, This <: ObservableMap[A, B, This]] requires This
extends Map[A, B]
- with Publisher[Message[Pair[A, B]]
+ with Publisher[Message[{A, B}]
with Undoable, This]
{
abstract override def update(key: A, value: B): Unit = get(key) match {
case None =>
super.update(key, value)
- publish(new Include(Pair(key, value)) with Undoable {
+ publish(new Include({key, value}) with Undoable {
def undo = -=(key)
})
case Some(old) =>
super.update(key, value)
- publish(new Update(Pair(key, value)) with Undoable {
+ publish(new Update({key, value}) with Undoable {
def undo = update(key, old)
})
}
@@ -44,7 +44,7 @@ trait ObservableMap[A, B, This <: ObservableMap[A, B, This]] requires This
case None =>
case Some(old) =>
super.-=(key)
- publish(new Remove(Pair(key, old)) with Undoable {
+ publish(new Remove({key, old}) with Undoable {
def undo = update(key, old)
})
}
diff --git a/src/library/scala/collection/mutable/PriorityQueue.scala b/src/library/scala/collection/mutable/PriorityQueue.scala
index 4f67392381..64a5ea0ddc 100644
--- a/src/library/scala/collection/mutable/PriorityQueue.scala
+++ b/src/library/scala/collection/mutable/PriorityQueue.scala
@@ -157,7 +157,7 @@ class PriorityQueue[A <% Ordered[A]] extends ResizableArray[A] {
that.isInstanceOf[PriorityQueue[A]] &&
{ val other = that.asInstanceOf[PriorityQueue[A]]
elements.zip(other.elements).forall {
- case Pair(thiselem, thatelem) => thiselem == thatelem
+ case {thiselem, thatelem} => thiselem == thatelem
}}
/** The hashCode method always yields an error, since it is not
diff --git a/src/library/scala/collection/mutable/Queue.scala b/src/library/scala/collection/mutable/Queue.scala
index 7c34c1f2ae..e2b4d8d913 100644
--- a/src/library/scala/collection/mutable/Queue.scala
+++ b/src/library/scala/collection/mutable/Queue.scala
@@ -167,7 +167,7 @@ class Queue[A] extends MutableList[A] {
that.isInstanceOf[Queue[A]] &&
{ val other = that.asInstanceOf[Queue[A]]
elements.zip(other.elements).forall {
- case Pair(thiselem, thatelem) => thiselem == thatelem
+ case {thiselem, thatelem} => thiselem == thatelem
}}
/** The hashCode method always yields an error, since it is not
diff --git a/src/library/scala/collection/mutable/RevertableHistory.scala b/src/library/scala/collection/mutable/RevertableHistory.scala
index 9ad19dedc7..f9fcb635b6 100644
--- a/src/library/scala/collection/mutable/RevertableHistory.scala
+++ b/src/library/scala/collection/mutable/RevertableHistory.scala
@@ -28,6 +28,6 @@ class RevertableHistory[A <: Undoable, B] extends History[A, B] with Undoable {
def undo: Unit = {
val old = log.toList.reverse
clear
- old.foreach { case Pair(sub, event) => event.undo }
+ old.foreach { case {sub, event} => event.undo }
}
}
diff --git a/src/library/scala/collection/mutable/Set.scala b/src/library/scala/collection/mutable/Set.scala
index 7ac715d136..16b1b8440b 100644
--- a/src/library/scala/collection/mutable/Set.scala
+++ b/src/library/scala/collection/mutable/Set.scala
@@ -24,7 +24,7 @@ package scala.collection.mutable
object Set {
/** The empty map of this type; this is implemented as a hashtable */
- def empty[A] = new HashSet[A]
+ def empty[A]: Set[A] = new HashSet[A]
/** The canonical factory for this type
*/
diff --git a/src/library/scala/collection/mutable/Stack.scala b/src/library/scala/collection/mutable/Stack.scala
index e3890d22df..1aee74148e 100644
--- a/src/library/scala/collection/mutable/Stack.scala
+++ b/src/library/scala/collection/mutable/Stack.scala
@@ -109,7 +109,7 @@ class Stack[A] extends MutableList[A] {
that.isInstanceOf[Stack[A]] &&
{ val other = that.asInstanceOf[Stack[A]];
elements.zip(other.elements).forall {
- case Pair(thiselem, thatelem) => thiselem == thatelem
+ case {thiselem, thatelem} => thiselem == thatelem
}}
/** The hashCode method always yields an error, since it is not
diff --git a/src/library/scala/collection/mutable/SynchronizedBuffer.scala b/src/library/scala/collection/mutable/SynchronizedBuffer.scala
index 652c6d535b..b86f7d401b 100644
--- a/src/library/scala/collection/mutable/SynchronizedBuffer.scala
+++ b/src/library/scala/collection/mutable/SynchronizedBuffer.scala
@@ -168,7 +168,7 @@ trait SynchronizedBuffer[A] extends Buffer[A] {
super.clear
}
- override def <<(cmd: Message[Pair[Location, A]]): Unit = synchronized {
+ override def <<(cmd: Message[{Location, A}]): Unit = synchronized {
super.<<(cmd)
}
diff --git a/src/library/scala/collection/mutable/SynchronizedMap.scala b/src/library/scala/collection/mutable/SynchronizedMap.scala
index 785e061a4e..da317123f0 100644
--- a/src/library/scala/collection/mutable/SynchronizedMap.scala
+++ b/src/library/scala/collection/mutable/SynchronizedMap.scala
@@ -57,11 +57,11 @@ trait SynchronizedMap[A, B] extends Map[A, B] {
super.values
}
- abstract override def elements: Iterator[Pair[A, B]] = synchronized {
+ abstract override def elements: Iterator[{A, B}] = synchronized {
super.elements
}
- override def toList: List[Pair[A, B]] = synchronized {
+ override def toList: List[{A, B}] = synchronized {
super.toList
}
@@ -69,7 +69,7 @@ trait SynchronizedMap[A, B] extends Map[A, B] {
super.update(key, value)
}
- override def += (kv: Pair[A, B]): Unit = synchronized {
+ override def += (kv: {A, B}): Unit = synchronized {
super.+=(kv)
}
@@ -78,19 +78,19 @@ trait SynchronizedMap[A, B] extends Map[A, B] {
* @param kv2 the second key/first value pair.
* @param kvs the remaining key/first value pairs.
*/
- override def += (kv1: Pair[A, B], kv2: Pair[A, B], kvs: Pair[A, B]*): Unit = synchronized {
+ override def += (kv1: {A, B}, kv2: {A, B}, kvs: {A, B}*): Unit = synchronized {
super.+=(kv1, kv2, kvs: _*)
}
- override def ++=(map: Iterable[Pair[A, B]]): Unit = synchronized {
+ override def ++=(map: Iterable[{A, B}]): Unit = synchronized {
super.++=(map)
}
- override def ++=(it: Iterator[Pair[A, B]]): Unit = synchronized {
+ override def ++=(it: Iterator[{A, B}]): Unit = synchronized {
super.++=(it)
}
- [deprecated] override def incl(mappings: Pair[A, B]*): Unit = synchronized {
+ [deprecated] override def incl(mappings: {A, B}*): Unit = synchronized {
super.incl(mappings: _*)
}
@@ -122,7 +122,7 @@ trait SynchronizedMap[A, B] extends Map[A, B] {
super.transform(f)
}
- [deprecated] override def map[C](f: Pair[A, B] => C) = synchronized {
+ [deprecated] override def map[C](f: {A, B} => C) = synchronized {
super.map(f)
}
@@ -131,7 +131,7 @@ trait SynchronizedMap[A, B] extends Map[A, B] {
}
/** @deprecated use retain instead */
- [deprecated] override def filter(p: Pair[A, B] => Boolean) = synchronized {
+ [deprecated] override def filter(p: {A, B} => Boolean) = synchronized {
super.filter(p)
}
@@ -147,7 +147,7 @@ trait SynchronizedMap[A, B] extends Map[A, B] {
super.hashCode()
}
- override def <<(cmd: Message[Pair[A, B]]): Unit = synchronized {
+ override def <<(cmd: Message[{A, B}]): Unit = synchronized {
super.<<(cmd)
}
diff --git a/src/library/scala/concurrent/MailBox.scala b/src/library/scala/concurrent/MailBox.scala
index e1399e9e58..b6ba205fa2 100644
--- a/src/library/scala/concurrent/MailBox.scala
+++ b/src/library/scala/concurrent/MailBox.scala
@@ -58,7 +58,7 @@ class MailBox extends AnyRef with ListQueueCreator {
private def scanSentMsgs[a](receiver: Receiver[a]): unit = synchronized {
messageQueue.extractFirst(sent, msg => receiver.isDefinedAt(msg)) match {
case None => receivers = receiverQueue.append(receivers, receiver)
- case Some(Pair(msg, withoutMsg)) => {
+ case Some{msg, withoutMsg} => {
sent = withoutMsg
receiver.msg = msg
}
@@ -73,7 +73,7 @@ class MailBox extends AnyRef with ListQueueCreator {
def send(msg: Message): unit = synchronized {
receiverQueue.extractFirst(receivers, r => r.isDefinedAt(msg)) match {
case None => sent = messageQueue.append(sent, msg)
- case Some(Pair(receiver, withoutReceiver)) => {
+ case Some{receiver, withoutReceiver} => {
receivers = withoutReceiver
receiver.msg = msg
receiver synchronized { receiver.notify() }
@@ -116,7 +116,7 @@ trait QueueModule[a] {
/** Append an element to a queue. */
def append(l: t, x: a): t
/** Extract an element satisfying a predicate from a queue. */
- def extractFirst(l: t, p: a => boolean): Option[Pair[a, t]]
+ def extractFirst(l: t, p: a => boolean): Option[{a, t}]
}
/** Inefficient but simple queue module creator. */
@@ -125,16 +125,16 @@ trait ListQueueCreator {
type t = List[a]
def make: t = Nil
def append(l: t, x: a): t = l ::: x :: Nil
- def extractFirst(l: t, p: a => boolean): Option[Pair[a, t]] =
+ def extractFirst(l: t, p: a => boolean): Option[{a, t}] =
l match {
case Nil => None
case head :: tail =>
if (p(head))
- Some(Pair(head, tail))
+ Some{head, tail}
else
extractFirst(tail, p) match {
case None => None
- case Some(Pair(x, without_x)) => Some(Pair(x, head :: without_x))
+ case Some{x, without_x} => Some{x, head :: without_x}
}
}
}
@@ -144,17 +144,17 @@ trait ListQueueCreator {
trait LinkedListQueueCreator {
import scala.collection.mutable.LinkedList
def queueCreate[a >: Null <: AnyRef]: QueueModule[a] = new QueueModule[a] {
- type t = Pair[LinkedList[a], LinkedList[a]] // fst = the list, snd = last elem
+ type t = {LinkedList[a], LinkedList[a]} // fst = the list, snd = last elem
def make: t = {
val l = new LinkedList[a](null, null)
- Pair(l, l)
+ {l, l}
}
def append(l: t, x: a): t = {
val atTail = new LinkedList(x, null)
l._2 append atTail;
- Pair(l._1, atTail)
+ {l._1, atTail}
}
- def extractFirst(l: t, p: a => boolean): Option[Pair[a, t]] = {
+ def extractFirst(l: t, p: a => boolean): Option[{a, t}] = {
var xs = l._1
var xs1 = xs.next
while ((xs1 ne null) && !p(xs1.elem)) {
@@ -166,7 +166,7 @@ trait LinkedListQueueCreator {
if (xs.next eq null)
Some(Pair(xs1.elem, Pair(l._1, xs)))
else
- Some(Pair(xs1.elem, l))
+ Some{xs1.elem, l}
}
else
None
diff --git a/src/library/scala/concurrent/Process.scala b/src/library/scala/concurrent/Process.scala
index 6aa2e5ff53..3e8589e7ef 100644
--- a/src/library/scala/concurrent/Process.scala
+++ b/src/library/scala/concurrent/Process.scala
@@ -68,7 +68,7 @@ class Process(body: => Unit) extends Actor() {
}
private def signal(s: MailBox#Message) =
- links.foreach { p: Process => p.send(Triple('EXIT, this, s)) }
+ links.foreach { p: Process => p.send({'EXIT, this, s}) }
def !(msg: MailBox#Message) =
send(msg)
diff --git a/src/library/scala/concurrent/jolib.scala b/src/library/scala/concurrent/jolib.scala
index 7fb6eebb09..afa23c0cb3 100644
--- a/src/library/scala/concurrent/jolib.scala
+++ b/src/library/scala/concurrent/jolib.scala
@@ -28,7 +28,7 @@ object jolib {
class Join {
- private var ruls: List[Pair[Pattern, Rule]] = null
+ private var ruls: List[{Pattern, Rule}] = null
def canMatch(p: Pattern) =
p forall { s => !s.queue.isEmpty }
@@ -36,13 +36,13 @@ object jolib {
def values(p: Pattern): List[Any] =
p map { s => s.queue.dequeue: Any }
- def rules(rs: Pair[Pattern, Rule]*) =
- ruls = rs.asInstanceOf[List[Pair[Pattern, Rule]]]
+ def rules(rs: {Pattern, Rule}*) =
+ ruls = rs.asInstanceOf[List[{Pattern, Rule}]]
def tryMatch =
- (ruls find { case Pair(p, _) => canMatch(p) }) match {
+ (ruls find { case {p, _} => canMatch(p) }) match {
case None => () => ()
- case Some(Pair(p, r)) => {
+ case Some{p, r} => {
val args = values(p)
() => concurrent.ops.spawn(r(args))
}
diff --git a/src/library/scala/concurrent/ops.scala b/src/library/scala/concurrent/ops.scala
index 73cfedc676..1c5b0e1713 100644
--- a/src/library/scala/concurrent/ops.scala
+++ b/src/library/scala/concurrent/ops.scala
@@ -44,10 +44,10 @@ object ops {
* @param yp ...
* @return ...
*/
- def par[a, b](xp: => a, yp: => b): Pair[a, b] = {
+ def par[a, b](xp: => a, yp: => b): {a, b} = {
val y = new SyncVar[b]
spawn { y set yp }
- Pair(xp, y.get)
+ {xp, y.get}
}
/**
diff --git a/src/library/scala/concurrent/pilib.scala b/src/library/scala/concurrent/pilib.scala
index b76a274219..bc76821884 100644
--- a/src/library/scala/concurrent/pilib.scala
+++ b/src/library/scala/concurrent/pilib.scala
@@ -157,13 +157,13 @@ object pilib {
* @param gs2 ...
* @return ...
*/
- private def matches(gs1: List[UGP], gs2: List[UGP]): Option[Triple[() => unit, () => Any, () => Any]] =
- Pair(gs1, gs2) match {
- case Pair(Nil, _) => None
- case Pair(_, Nil) => None
- case Pair(UGP(a1, d1, v1, c1) :: rest1, UGP(a2, d2, v2, c2) :: rest2) =>
+ private def matches(gs1: List[UGP], gs2: List[UGP]): Option[{() => unit, () => Any, () => Any}] =
+ {gs1, gs2} match {
+ case {Nil, _} => None
+ case {_, Nil} => None
+ case {UGP(a1, d1, v1, c1) :: rest1, UGP(a2, d2, v2, c2) :: rest2} =>
if (a1 == a2 && d1 == !d2)
- Some(Triple(() => if (d1) a1.log(v2) else a1.log(v1), () => c1(v2), () => c2(v1)))
+ Some{(() => if (d1) a1.log(v2) else a1.log(v1)), (() => c1(v2)), (() => c2(v1))}
else matches(gs1, rest2) match {
case None => matches(rest1, gs2)
case Some(t) => Some(t)
@@ -183,12 +183,11 @@ object pilib {
case Nil => ss ::: List(s1)
case s2 :: rest => matches(s1.gs, s2.gs) match {
case None => s2 :: compare(s1, rest)
- case Some(Triple(log, c1, c2)) => {
+ case Some{log, c1, c2} =>
log()
s1.set(c1)
s2.set(c2)
rest
- }
}
}
diff --git a/src/library/scala/mobile/Code.scala b/src/library/scala/mobile/Code.scala
index e90d7015a3..2f2b6c3832 100644
--- a/src/library/scala/mobile/Code.scala
+++ b/src/library/scala/mobile/Code.scala
@@ -158,17 +158,17 @@ class Code(clazz: java.lang.Class) {
////////////////////// private functions ///////////////////////
private def boxValue(value: Any) = value match {
- case x: Byte => Pair(new java.lang.Byte(x), java.lang.Byte.TYPE)
- case x: Boolean => Pair(new java.lang.Boolean(x), java.lang.Boolean.TYPE)
- case x: Char => Pair(new java.lang.Character(x), java.lang.Character.TYPE)
- case x: Short => Pair(new java.lang.Short(x), java.lang.Short.TYPE)
- case x: Int => Pair(new java.lang.Integer(x), java.lang.Integer.TYPE)
- case x: Long => Pair(new java.lang.Long(x), java.lang.Long.TYPE)
- case x: Float => Pair(new java.lang.Float(x), java.lang.Float.TYPE)
- case x: Double => Pair(new java.lang.Double(x), java.lang.Double.TYPE)
+ case x: Byte => {new java.lang.Byte(x), java.lang.Byte.TYPE}
+ case x: Boolean => {new java.lang.Boolean(x), java.lang.Boolean.TYPE}
+ case x: Char => {new java.lang.Character(x), java.lang.Character.TYPE}
+ case x: Short => {new java.lang.Short(x), java.lang.Short.TYPE}
+ case x: Int => {new java.lang.Integer(x), java.lang.Integer.TYPE}
+ case x: Long => {new java.lang.Long(x), java.lang.Long.TYPE}
+ case x: Float => {new java.lang.Float(x), java.lang.Float.TYPE}
+ case x: Double => {new java.lang.Double(x), java.lang.Double.TYPE}
case _ =>
val x = value.asInstanceOf[JObject]
- Pair(x, x.getClass())
+ {x, x.getClass()}
}
private def isConstructorName(methName: String) = {
diff --git a/src/library/scala/reflect/Type.scala b/src/library/scala/reflect/Type.scala
index de5dc52479..fb1acbc650 100644
--- a/src/library/scala/reflect/Type.scala
+++ b/src/library/scala/reflect/Type.scala
@@ -41,7 +41,7 @@ case class TypeBounds(lo: Type, hi: Type) extends Type
case class MethodType(formals: List[Type], restpe: Type) extends Type
/** */
-case class PolyType(typeParams: List[Symbol], typeBounds: List[Pair[Type, Type]], resultType: Type) extends Type
+case class PolyType(typeParams: List[Symbol], typeBounds: List[{Type, Type}], resultType: Type) extends Type
/** */
class ImplicitMethodType(formals: List[Type], restpe: Type)
diff --git a/src/library/scala/text/Document.scala b/src/library/scala/text/Document.scala
index 70e7bc8fc7..4818c342fd 100644
--- a/src/library/scala/text/Document.scala
+++ b/src/library/scala/text/Document.scala
@@ -50,20 +50,20 @@ abstract class Document {
false
case List() =>
true
- case Triple(_, _, DocNil) :: z =>
+ case {_, _, DocNil} :: z =>
fits(w, z)
- case Triple(i, b, DocCons(h, t)) :: z =>
- fits(w, Triple(i,b,h) :: Triple(i,b,t) :: z)
- case Triple(_, _, DocText(t)) :: z =>
+ case {i, b, DocCons(h, t)} :: z =>
+ fits(w, {i,b,h} :: {i,b,t} :: z)
+ case {_, _, DocText(t)} :: z =>
fits(w - t.length(), z)
- case Triple(i, b, DocNest(ii, d)) :: z =>
- fits(w, Triple(i + ii, b, d) :: z)
- case Triple(_, false, DocBreak) :: z =>
+ case {i, b, DocNest(ii, d)} :: z =>
+ fits(w, {i + ii, b, d} :: z)
+ case {_, false, DocBreak} :: z =>
fits(w - 1, z)
- case Triple(_, true, DocBreak) :: z =>
+ case {_, true, DocBreak} :: z =>
true
- case Triple(i, _, DocGroup(d)) :: z =>
- fits(w, Triple(i, false, d) :: z)
+ case {i, _, DocGroup(d)} :: z =>
+ fits(w, {i, false, d} :: z)
}
def spaces(n: Int): Unit = {
@@ -77,28 +77,28 @@ abstract class Document {
def fmt(k: Int, state: List[FmtState]): Unit = state match {
case List() => ()
- case Triple(_, _, DocNil) :: z =>
+ case {_, _, DocNil} :: z =>
fmt(k, z)
- case Triple(i, b, DocCons(h, t)) :: z =>
- fmt(k, Triple(i, b, h) :: Triple(i, b, t) :: z)
- case Triple(i, _, DocText(t)) :: z =>
+ case {i, b, DocCons(h, t)} :: z =>
+ fmt(k, {i, b, h} :: {i, b, t} :: z)
+ case {i, _, DocText(t)} :: z =>
writer write t
fmt(k + t.length(), z)
- case Triple(i, b, DocNest(ii, d)) :: z =>
- fmt(k, Triple(i + ii, b, d) :: z)
- case Triple(i, true, DocBreak) :: z =>
+ case {i, b, DocNest(ii, d)} :: z =>
+ fmt(k, {i + ii, b, d} :: z)
+ case {i, true, DocBreak} :: z =>
writer write "\n"
spaces(i);
fmt(i, z)
- case Triple(i, false, DocBreak) :: z =>
+ case {i, false, DocBreak} :: z =>
writer write " "
fmt(k + 1, z)
- case Triple(i, b, DocGroup(d)) :: z =>
- val fitsFlat = fits(width - k, Triple(i, false, d) :: z)
- fmt(k, Triple(i, !fitsFlat, d) :: z)
+ case {i, b, DocGroup(d)} :: z =>
+ val fitsFlat = fits(width - k, {i, false, d} :: z)
+ fmt(k, {i, !fitsFlat, d} :: z)
}
- fmt(0, Triple(0, false, DocGroup(this)) :: Nil)
+ fmt(0, {0, false, DocGroup(this)} :: Nil)
}
}
diff --git a/src/library/scala/xml/MetaData.scala b/src/library/scala/xml/MetaData.scala
index cc2b683b18..0eb572a801 100644
--- a/src/library/scala/xml/MetaData.scala
+++ b/src/library/scala/xml/MetaData.scala
@@ -102,7 +102,7 @@ abstract class MetaData extends Iterable[MetaData] {
}
/** returns an iterator on attributes */
- def elements = new Iterator[MetaData] {
+ def elements: Iterator[MetaData] = new Iterator[MetaData] {
var x: MetaData = MetaData.this
def hasNext = Null != x
def next = {