summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-02-21 19:10:41 +0000
committerMartin Odersky <odersky@gmail.com>2007-02-21 19:10:41 +0000
commit914932babf9343fdfcec20f25bfb1576dc8c433b (patch)
tree088e404a21862209be434b0236c34e4576042c51 /src/compiler
parentcb7f66a22c9167a7e8ffce042a4bf1c5c9849a89 (diff)
downloadscala-914932babf9343fdfcec20f25bfb1576dc8c433b.tar.gz
scala-914932babf9343fdfcec20f25bfb1576dc8c433b.tar.bz2
scala-914932babf9343fdfcec20f25bfb1576dc8c433b.zip
Removed Pair(...), Triple(...).
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/CompileClient.scala6
-rw-r--r--src/compiler/scala/tools/nsc/CompileSocket.scala10
-rw-r--r--src/compiler/scala/tools/nsc/GenericRunnerSettings.scala8
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala4
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala8
-rw-r--r--src/compiler/scala/tools/nsc/InterpreterLoop.scala8
-rw-r--r--src/compiler/scala/tools/nsc/ScriptRunner.scala10
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala92
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeGen.scala31
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeInfo.scala19
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreePrinters.scala2
-rw-r--r--src/compiler/scala/tools/nsc/ast/Trees.scala8
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala8
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala52
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala26
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Checkers.scala14
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala28
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/ICodes.scala2
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Members.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala82
-rw-r--r--src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala34
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala10
-rw-r--r--src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala2
-rw-r--r--src/compiler/scala/tools/nsc/doc/DocGenerator.scala32
-rw-r--r--src/compiler/scala/tools/nsc/matching/PatternMatchers.scala8
-rw-r--r--src/compiler/scala/tools/nsc/matching/PatternNodes.scala8
-rw-r--r--src/compiler/scala/tools/nsc/matching/TransMatcher.scala6
-rw-r--r--src/compiler/scala/tools/nsc/models/SemanticTokens.scala10
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Definitions.scala4
-rw-r--r--src/compiler/scala/tools/nsc/symtab/StdNames.scala4
-rw-r--r--src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala6
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Symbols.scala4
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala152
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala12
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala38
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala12
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala4
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala18
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala24
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala14
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Infer.scala18
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala10
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala10
-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.scala237
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Variances.scala2
48 files changed, 591 insertions, 520 deletions
diff --git a/src/compiler/scala/tools/nsc/CompileClient.scala b/src/compiler/scala/tools/nsc/CompileClient.scala
index bb24ad2d30..7c3a664641 100644
--- a/src/compiler/scala/tools/nsc/CompileClient.scala
+++ b/src/compiler/scala/tools/nsc/CompileClient.scala
@@ -35,7 +35,7 @@ object CompileClient {
pathsList.map(absFileName).mkString("", sep, "")
}
- private def normalize(args: Array[String]): Pair[String, String] = {
+ private def normalize(args: Array[String]): (String, String) = {
var i = 0
val vmArgs = new StringBuilder
var serverAdr = ""
@@ -70,7 +70,7 @@ object CompileClient {
}
}
}
- Pair(vmArgs.toString, serverAdr)
+ (vmArgs.toString, serverAdr)
}
// used by class ant.FastScalac to skip exit statement in Ant.
@@ -81,7 +81,7 @@ object CompileClient {
else
("-d" :: "." :: args0.toList).toArray
- val Pair(vmArgs, serverAdr) = normalize(args)
+ val (vmArgs, serverAdr) = normalize(args)
if (version) {
Console.println(versionMsg)
return 0
diff --git a/src/compiler/scala/tools/nsc/CompileSocket.scala b/src/compiler/scala/tools/nsc/CompileSocket.scala
index 0fa020d4d3..0f9147de8a 100644
--- a/src/compiler/scala/tools/nsc/CompileSocket.scala
+++ b/src/compiler/scala/tools/nsc/CompileSocket.scala
@@ -55,13 +55,13 @@ object CompileSocket {
/** The temporary directory in which the port identification file is stored */
private val tmpDir = {
val totry = List(
- Pair("scala.home", List("var", "scala-devel")),
- Pair("user.home", List("tmp")),
- Pair("java.io.tmpdir", Nil))
+ ("scala.home", List("var", "scala-devel")),
+ ("user.home", List("tmp")),
+ ("java.io.tmpdir", Nil))
/** Expand a property-extensions pair into a complete File object */
- def expand(trial: Pair[String, List[String]]): Option[File] = {
- val Pair(topdirProp, extensions) = trial
+ def expand(trial: (String, List[String])): Option[File] = {
+ val (topdirProp, extensions) = trial
val topdir = System.getProperty(topdirProp)
if (topdir eq null)
return None
diff --git a/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala b/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala
index 4503abf241..cf6e6672db 100644
--- a/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala
+++ b/src/compiler/scala/tools/nsc/GenericRunnerSettings.scala
@@ -36,7 +36,7 @@ extends Settings(error) {
class DefinesSetting
extends Setting("-D<prop>", "set a Java property")
{
- private val props = new Queue[Pair[String, String]]
+ private val props = new Queue[(String, String)]
def value = props.toList
@@ -49,9 +49,9 @@ extends Settings(error) {
val eqidx = stripD.indexOf('=')
val addition =
if(eqidx < 0)
- Pair(stripD, "")
+ (stripD, "")
else
- Pair(stripD.substring(0, eqidx), stripD.substring(eqidx+1))
+ (stripD.substring(0, eqidx), stripD.substring(eqidx+1))
props += addition
rest
}
@@ -63,7 +63,7 @@ extends Settings(error) {
/** Apply the specified properties to the current JVM */
def applyToCurrentJVM = {
val systemProps = getProperties
- for(val Pair(key, value) <- props.toList)
+ for(val (key, value) <- props.toList)
systemProps.setProperty(key, value)
}
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 016d84f6b1..8d8297afd1 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -507,7 +507,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
showDef(newTermName(settings.Xshowobj.value), true)
if (reporter.hasErrors) {
- for (val Pair(sym, file) <- symSource.elements) {
+ for (val (sym, file) <- symSource.elements) {
sym.reset(new loaders.SourcefileLoader(file))
if (sym.isTerm) sym.moduleClass.reset(loaders.moduleClassLoader)
}
@@ -520,7 +520,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
warning("there were unchecked warnings; re-run with -unchecked for details")
}
}
- for (val Pair(sym, file) <- symSource.elements) resetPackageClass(sym.owner)
+ for (val (sym, file) <- symSource.elements) resetPackageClass(sym.owner)
//units foreach (.clear())
informTime("total", startTime)
}
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index c8115cf7b4..c66590c359 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -282,7 +282,7 @@ class Interpreter(val settings: Settings, reporter: Reporter, out: PrintWriter)
if (!req.compile)
return IR.Error // an error happened during compilation, e.g. a type error
- val Pair(interpreterResultString, succeeded) = req.loadAndRun
+ val (interpreterResultString, succeeded) = req.loadAndRun
if (printResults || !succeeded) {
// print the result
@@ -553,20 +553,20 @@ class Interpreter(val settings: Settings, reporter: Reporter, out: PrintWriter)
}
/** load and run the code using reflection */
- def loadAndRun: Pair[String, Boolean] = {
+ def loadAndRun: (String, Boolean) = {
val interpreterResultObject: Class =
Class.forName(resultObjectName, true, classLoader)
val resultValMethod: java.lang.reflect.Method =
interpreterResultObject.getMethod("result", null)
try {
- Pair(resultValMethod.invoke(interpreterResultObject, null).toString(),
+ (resultValMethod.invoke(interpreterResultObject, null).toString(),
true)
} catch {
case e => {
def caus(e: Throwable): Throwable =
if (e.getCause eq null) e else caus(e.getCause)
val orig = caus(e)
- Pair(stringFrom(str => orig.printStackTrace(str)),
+ (stringFrom(str => orig.printStackTrace(str)),
false)
}
}
diff --git a/src/compiler/scala/tools/nsc/InterpreterLoop.scala b/src/compiler/scala/tools/nsc/InterpreterLoop.scala
index 6696f210df..a353c2b3e8 100644
--- a/src/compiler/scala/tools/nsc/InterpreterLoop.scala
+++ b/src/compiler/scala/tools/nsc/InterpreterLoop.scala
@@ -108,7 +108,7 @@ class InterpreterLoop(in0: BufferedReader, out: PrintWriter) {
if (line eq null)
return () // assumes null means EOF
- val Pair(keepGoing, finalLineMaybe) = command(line)
+ val (keepGoing, finalLineMaybe) = command(line)
if (!keepGoing)
return
@@ -158,7 +158,7 @@ class InterpreterLoop(in0: BufferedReader, out: PrintWriter) {
/** Run one command submitted by the user. Three values are returned:
* (1) whether to keep running, (2) the line to record for replay,
* if any. */
- def command(line: String): Pair[Boolean, Option[String]] = {
+ def command(line: String): (Boolean, Option[String]) = {
def withFile(command: String)(action: String => Unit): Unit = {
val spaceIdx = command.indexOf(' ')
if (spaceIdx <= 0) {
@@ -183,7 +183,7 @@ class InterpreterLoop(in0: BufferedReader, out: PrintWriter) {
if (line.matches(helpRegexp))
printHelp
else if (line.matches(quitRegexp))
- return Pair(false, None)
+ return (false, None)
else if (line.matches(loadRegexp)) {
withFile(line)(f => {
interpretAllFrom(f)
@@ -197,7 +197,7 @@ class InterpreterLoop(in0: BufferedReader, out: PrintWriter) {
else
shouldReplay = interpretStartingWith(line)
- Pair(true, shouldReplay)
+ (true, shouldReplay)
}
/** Interpret expressions starting with the first line.
diff --git a/src/compiler/scala/tools/nsc/ScriptRunner.scala b/src/compiler/scala/tools/nsc/ScriptRunner.scala
index e541cfc906..6ee8348600 100644
--- a/src/compiler/scala/tools/nsc/ScriptRunner.scala
+++ b/src/compiler/scala/tools/nsc/ScriptRunner.scala
@@ -227,7 +227,7 @@ object ScriptRunner {
* the directory with the compiled class files,
* and a flag for whether the compilation succeeded.
*/
- def compile: Pair[File, Boolean] = {
+ def compile: (File, Boolean) = {
val compiledPath = File.createTempFile("scalascript", "")
compiledPath.delete // the file is created as a file; make it a directory
compiledPath.mkdirs
@@ -239,10 +239,10 @@ object ScriptRunner {
val compiler = new Global(settings, reporter)
val cr = new compiler.Run
cr.compileSources(List(wrappedScript(scriptFile, &compiler.getSourceFile)))
- Pair(compiledPath, !reporter.hasErrors)
+ (compiledPath, !reporter.hasErrors)
} else {
val compok = compileWithDaemon(settings, scriptFile)
- Pair(compiledPath, compok)
+ (compiledPath, compok)
}
}
@@ -258,7 +258,7 @@ object ScriptRunner {
} else {
// The pre-compiled jar is old. Recompile the script.
jarFile.delete
- val Pair(compiledPath, compok) = compile
+ val (compiledPath, compok) = compile
try {
if (compok) {
tryMakeJar(jarFile, compiledPath)
@@ -277,7 +277,7 @@ object ScriptRunner {
}
} else {
// don't use the cache; just run from the interpreter's temporary directory
- val Pair(compiledPath, compok) = compile
+ val (compiledPath, compok) = compile
try {
if (compok)
handler(compiledPath.getPath)
diff --git a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
index 038daeb815..057071f97f 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeBrowsers.scala
@@ -173,7 +173,7 @@ abstract class TreeBrowsers {
override def convertValueToText(value: Any, sel: Boolean,
exp: Boolean, leaf: Boolean,
row: Int, hasFocus: Boolean) = {
- val Pair(cls, name) = TreeInfo.treeName(value.asInstanceOf[Tree])
+ val (cls, name) = TreeInfo.treeName(value.asInstanceOf[Tree])
if (name != EMPTY)
cls + "[" + name.toString() + "]"
else
@@ -250,138 +250,138 @@ abstract class TreeBrowsers {
object TreeInfo {
/** Return the case class name and the Name, if the node defines one */
- def treeName(t: Tree): Pair[String, Name] = t match {
+ def treeName(t: Tree): (String, Name) = t match {
case ProgramTree(units) =>
- Pair("Program", EMPTY)
+ ("Program", EMPTY)
case UnitTree(unit) =>
- Pair("CompilationUnit", unit.toString())
+ ("CompilationUnit", unit.toString())
case DocDef(comment, definition) =>
- Pair("DocDef", EMPTY)
+ ("DocDef", EMPTY)
case ClassDef(mods, name, tparams, self, impl) =>
- Pair("ClassDef", name)
+ ("ClassDef", name)
case PackageDef(packaged, impl) =>
- Pair("PackageDef", EMPTY)
+ ("PackageDef", EMPTY)
case ModuleDef(mods, name, impl) =>
- Pair("ModuleDef", name)
+ ("ModuleDef", name)
case ValDef(mods, name, tpe, rhs) =>
- Pair("ValDef", name)
+ ("ValDef", name)
case DefDef(mods, name, tparams, vparams, tpe, rhs) =>
- Pair("DefDef", name)
+ ("DefDef", name)
case AbsTypeDef(mods, name, rhs, lobound) =>
- Pair("AbsTypeDef", name)
+ ("AbsTypeDef", name)
case AliasTypeDef(mods, name, tparams, rhs) =>
- Pair("AliasTypeDef", name)
+ ("AliasTypeDef", name)
case Import(expr, selectors) =>
- Pair("Import", EMPTY)
+ ("Import", EMPTY)
case CaseDef(pat, guard, body) =>
- Pair("CaseDef", EMPTY)
+ ("CaseDef", EMPTY)
case Template(parents, body) =>
- Pair("Template", EMPTY)
+ ("Template", EMPTY)
case LabelDef(name, params, rhs) =>
- Pair("LabelDef", name)
+ ("LabelDef", name)
case Block(stats, expr) =>
- Pair("Block", EMPTY)
+ ("Block", EMPTY)
case Sequence(trees) =>
- Pair("Sequence", EMPTY)
+ ("Sequence", EMPTY)
case Alternative(trees) =>
- Pair("Alternative", EMPTY)
+ ("Alternative", EMPTY)
case Bind(name, rhs) =>
- Pair("Bind", name)
+ ("Bind", name)
case Match(selector, cases) =>
- Pair("Visitor", EMPTY)
+ ("Visitor", EMPTY)
case Function(vparams, body) =>
- Pair("Function", EMPTY)
+ ("Function", EMPTY)
case Assign(lhs, rhs) =>
- Pair("Assign", EMPTY)
+ ("Assign", EMPTY)
case If(cond, thenp, elsep) =>
- Pair("If", EMPTY)
+ ("If", EMPTY)
case Return(expr) =>
- Pair("Return", EMPTY)
+ ("Return", EMPTY)
case Throw(expr) =>
- Pair("Throw", EMPTY)
+ ("Throw", EMPTY)
case New(init) =>
- Pair("New", EMPTY)
+ ("New", EMPTY)
case Typed(expr, tpe) =>
- Pair("Typed", EMPTY)
+ ("Typed", EMPTY)
case TypeApply(fun, args) =>
- Pair("TypeApply", EMPTY)
+ ("TypeApply", EMPTY)
case Apply(fun, args) =>
- Pair("Apply", EMPTY)
+ ("Apply", EMPTY)
case Super(qualif, mix) =>
- Pair("Super", qualif.toString() + ", mix: " + mix.toString())
+ ("Super", qualif.toString() + ", mix: " + mix.toString())
case This(qualifier) =>
- Pair("This", qualifier)
+ ("This", qualifier)
case Select(qualifier, selector) =>
- Pair("Select", selector)
+ ("Select", selector)
case Ident(name) =>
- Pair("Ident", name)
+ ("Ident", name)
case Literal(value) =>
- Pair("Literal", EMPTY)
+ ("Literal", EMPTY)
case TypeTree() =>
- Pair("TypeTree", EMPTY)
+ ("TypeTree", EMPTY)
case Annotated(constr, elements, arg) =>
- Pair("Annotated", EMPTY)
+ ("Annotated", EMPTY)
case AttributedTypeTree(attribs, tpt) =>
- Pair("AttributedTypeTree", EMPTY)
+ ("AttributedTypeTree", EMPTY)
case SingletonTypeTree(ref) =>
- Pair("SingletonType", EMPTY)
+ ("SingletonType", EMPTY)
case SelectFromTypeTree(qualifier, selector) =>
- Pair("SelectFromType", selector)
+ ("SelectFromType", selector)
case CompoundTypeTree(template) =>
- Pair("CompoundType", EMPTY)
+ ("CompoundType", EMPTY)
case AppliedTypeTree(tpe, args) =>
- Pair("AppliedType", EMPTY)
+ ("AppliedType", EMPTY)
case Try(block, catcher, finalizer) =>
- Pair("Try", EMPTY)
+ ("Try", EMPTY)
case EmptyTree =>
- Pair("Empty", EMPTY)
+ ("Empty", EMPTY)
case ArrayValue(elemtpt, trees) =>
- Pair("ArrayValue", EMPTY)
+ ("ArrayValue", EMPTY)
case Star(t) =>
- Pair("Star", EMPTY)
+ ("Star", EMPTY)
}
/** Return a list of children for the given tree node */
diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
index 28a7fd10b0..2ff4b41266 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
@@ -8,6 +8,7 @@ package scala.tools.nsc.ast
import scala.tools.nsc.util.Position
import symtab.Flags._
+import scala.collection.mutable.ListBuffer
abstract class TreeGen {
@@ -205,4 +206,34 @@ abstract class TreeGen {
def mkRuntimeCall(meth: Name, args: List[Tree]): Tree =
Apply(Select(mkAttributedRef(ScalaRunTimeModule), meth), args)
+
+ def evalOnce(expr: Tree, owner: Symbol, unit: CompilationUnit)(within: (() => Tree) => Tree): Tree =
+ if (treeInfo.isPureExpr(expr)) {
+ within(() => expr);
+ } else {
+ val temp = owner.newValue(expr.pos, unit.fresh.newName())
+ .setFlag(SYNTHETIC).setInfo(expr.tpe);
+ atPos(expr.pos) {
+ Block(List(ValDef(temp, expr)), within(() => Ident(temp) setType expr.tpe))
+ }
+ }
+
+ def evalOnceAll(exprs: List[Tree], owner: Symbol, unit: CompilationUnit)(within: (List[() => Tree]) => Tree): Tree = {
+ val vdefs = new ListBuffer[ValDef]
+ val exprs1 = new ListBuffer[() => Tree]
+ for (val expr <- exprs) {
+ if (treeInfo.isPureExpr(expr)) {
+ exprs1 += (() => expr)
+ } else {
+ val temp = owner.newValue(expr.pos, unit.fresh.newName())
+ .setFlag(SYNTHETIC).setInfo(expr.tpe)
+ vdefs += ValDef(temp, expr)
+ exprs1 += (() => Ident(temp) setType expr.tpe)
+ }
+ }
+ val prefix = vdefs.toList
+ val result = within(exprs1.toList)
+ if (prefix.isEmpty) result
+ else Block(prefix, result) setPos prefix.head.pos
+ }
}
diff --git a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
index 13980856ec..d4ff2d1737 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
@@ -96,6 +96,25 @@ abstract class TreeInfo {
false
}
+ def mayBeVarGetter(sym: Symbol) = sym.info match {
+ case PolyType(List(), _) => sym.owner.isClass && !sym.isStable
+ case _: ImplicitMethodType => sym.owner.isClass && !sym.isStable
+ case _ => false
+ }
+
+ def isVariableOrGetter(tree: Tree) = tree match {
+ case Ident(_) =>
+ tree.symbol.isVariable
+ case Select(qual, _) =>
+ tree.symbol.isVariable ||
+ (mayBeVarGetter(tree.symbol) &&
+ tree.symbol.owner.info.decl(nme.getterToSetter(tree.symbol.name)) != NoSymbol)
+ case Apply(Select(qual, nme.apply), _) =>
+ qual.tpe.decl(nme.update) != NoSymbol
+ case _ =>
+ false
+ }
+
/** Is tree a self constructor call?
*/
def isSelfConstrCall(tree: Tree): boolean = tree match {
diff --git a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
index 5294cb5fc6..c592c01af0 100644
--- a/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreePrinters.scala
@@ -177,7 +177,7 @@ abstract class TreePrinters {
print(symName(tree, name)); printRow(params, "(", ",", ")"); printBlock(rhs)
case Import(expr, selectors) =>
- def selectorToString(s: Pair[Name, Name]): String =
+ def selectorToString(s: (Name, Name)): String =
if (s._1 == nme.WILDCARD || s._1 == s._2) s._1.toString()
else s._1.toString() + "=>" + s._2.toString()
print("import "); print(expr)
diff --git a/src/compiler/scala/tools/nsc/ast/Trees.scala b/src/compiler/scala/tools/nsc/ast/Trees.scala
index a2085bb50b..d4f400169d 100644
--- a/src/compiler/scala/tools/nsc/ast/Trees.scala
+++ b/src/compiler/scala/tools/nsc/ast/Trees.scala
@@ -409,7 +409,7 @@ trait Trees requires Global {
* @param expr
* @param selectors
*/
- case class Import(expr: Tree, selectors: List[Pair[Name, Name]])
+ case class Import(expr: Tree, selectors: List[(Name, Name)])
extends SymTree
/** Annotation application (constructor arguments + name-value pairs) */
@@ -751,7 +751,7 @@ trait Trees requires Global {
def AbsTypeDef(tree: Tree, mods: Modifiers, name: Name, lo: Tree, hi: Tree): AbsTypeDef
def AliasTypeDef(tree: Tree, mods: Modifiers, name: Name, tparams: List[AbsTypeDef], rhs: Tree): AliasTypeDef
def LabelDef(tree: Tree, name: Name, params: List[Ident], rhs: Tree): LabelDef
- def Import(tree: Tree, expr: Tree, selectors: List[Pair[Name, Name]]): Import
+ def Import(tree: Tree, expr: Tree, selectors: List[(Name, Name)]): Import
def Annotation(tree: Tree, constr: Tree, elements: List[Tree]): Annotation
def DocDef(tree: Tree, comment: String, definition: Tree): DocDef
def Template(tree: Tree, parents: List[Tree], body: List[Tree]): Template
@@ -806,7 +806,7 @@ trait Trees requires Global {
new AliasTypeDef(mods, name, tparams, rhs).copyAttrs(tree)
def LabelDef(tree: Tree, name: Name, params: List[Ident], rhs: Tree) =
new LabelDef(name, params, rhs).copyAttrs(tree)
- def Import(tree: Tree, expr: Tree, selectors: List[Pair[Name, Name]]) =
+ def Import(tree: Tree, expr: Tree, selectors: List[(Name, Name)]) =
new Import(expr, selectors).copyAttrs(tree)
def Annotation(tree: Tree, constr: Tree, elements: List[Tree]) =
new Annotation(constr, elements)
@@ -923,7 +923,7 @@ trait Trees requires Global {
if (name0 == name) && (params0 == params) && (rhs0 == rhs) => t
case _ => copy.LabelDef(tree, name, params, rhs)
}
- def Import(tree: Tree, expr: Tree, selectors: List[Pair[Name, Name]]) = tree match {
+ def Import(tree: Tree, expr: Tree, selectors: List[(Name, Name)]) = tree match {
case t @ Import(expr0, selectors0)
if (expr0 == expr) && (selectors0 == selectors) => t
case _ => copy.Import(tree, expr, selectors)
diff --git a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala
index 4e1d73b53f..1da2a5e779 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/MarkupParsers.scala
@@ -62,7 +62,7 @@ class MarkupParser(unit: CompilationUnit, s: Scanner, p: Parser, presWS: boolean
else
reportSyntaxError("'" + that + "' expected instead of '" + ch + "'")
- var debugLastStartElement = new mutable.Stack[Pair[Int, String]]
+ var debugLastStartElement = new mutable.Stack[(Int, String)]
/** checks whether next character starts a Scala block, if yes, skip it.
* @return true if next character starts a scala block
@@ -143,7 +143,7 @@ class MarkupParser(unit: CompilationUnit, s: Scanner, p: Parser, presWS: boolean
* [40] STag ::= '<' Name { S Attribute } [S]
* [44] EmptyElemTag ::= '<' Name { S Attribute } [S]
*/
- /*[Duplicate]*/ def xTag: Pair[String, mutable.Map[String, Tree]] = {
+ /*[Duplicate]*/ def xTag: (String, mutable.Map[String, Tree]) = {
val elemName = xName
xSpaceOpt
val aMap =
@@ -378,7 +378,7 @@ class MarkupParser(unit: CompilationUnit, s: Scanner, p: Parser, presWS: boolean
if(qname == "xml:unparsed")
return xUnparsed
- debugLastStartElement.push(Pair(pos1, qname))
+ debugLastStartElement.push((pos1, qname))
val ts = content
xEndTag(qname)
debugLastStartElement.pop
@@ -613,7 +613,7 @@ class MarkupParser(unit: CompilationUnit, s: Scanner, p: Parser, presWS: boolean
//Console.println("xPattern")
val pos1 = pos
val qname = xName
- debugLastStartElement.push(Pair(pos1, qname))
+ debugLastStartElement.push((pos1, qname))
xSpaceOpt
if (ch == '/') { // empty tag
nextch
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index e21460633c..6f4247b49e 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -1059,8 +1059,8 @@ trait Parsers requires SyntaxAnalyzer {
parents += annotType(false)
}
newLineOptWhenFollowedBy(LBRACE)
- val Pair(self, stats) = if (in.token == LBRACE) templateBody()
- else Pair(emptyValDef, List())
+ val (self, stats) = if (in.token == LBRACE) templateBody()
+ else (emptyValDef, List())
makeNew(parents.toList, self, stats, argss.toList)
}
canApply = false
@@ -1704,7 +1704,7 @@ trait Parsers requires SyntaxAnalyzer {
def loop: Tree =
if (in.token == USCORE) {
in.nextToken()
- Import(t, List(Pair(nme.WILDCARD, null)))
+ Import(t, List((nme.WILDCARD, null)))
} else if (in.token == LBRACE) {
Import(t, importSelectors())
} else {
@@ -1714,7 +1714,7 @@ trait Parsers requires SyntaxAnalyzer {
pos = accept(DOT)
loop
} else {
- Import(t, List(Pair(name, name)))
+ Import(t, List((name, name)))
}
}
loop
@@ -1722,8 +1722,8 @@ trait Parsers requires SyntaxAnalyzer {
/** ImportSelectors ::= `{' {ImportSelector `,'} (ImportSelector | `_') `}'
*/
- def importSelectors(): List[Pair[Name, Name]] = {
- val names = new ListBuffer[Pair[Name, Name]]
+ def importSelectors(): List[(Name, Name)] = {
+ val names = new ListBuffer[(Name, Name)]
accept(LBRACE)
var isLast = importSelector(names)
while (!isLast && in.token == COMMA) {
@@ -1736,12 +1736,12 @@ trait Parsers requires SyntaxAnalyzer {
/** ImportSelector ::= Id [`=>' Id | `=>' `_']
*/
- def importSelector(names: ListBuffer[Pair[Name, Name]]): boolean =
+ def importSelector(names: ListBuffer[(Name, Name)]): boolean =
if (in.token == USCORE) {
- in.nextToken(); names += Pair(nme.WILDCARD, null); true
+ in.nextToken(); names += (nme.WILDCARD, null); true
} else {
val name = ident()
- names += Pair(
+ names += (
name,
if (in.token == ARROW) {
in.nextToken()
@@ -1821,9 +1821,9 @@ trait Parsers requires SyntaxAnalyzer {
*/
def varDefOrDcl(mods: Modifiers): List[Tree] = {
var newmods = mods | Flags.MUTABLE
- val lhs = new ListBuffer[Pair[Int, Name]]
+ val lhs = new ListBuffer[(Int, Name)]
do {
- lhs += Pair(in.skipToken(), ident())
+ lhs += (in.skipToken(), ident())
} while (in.token == COMMA)
val tp = typedOpt()
val rhs = if (tp.isEmpty || in.token == EQUALS) {
@@ -1838,7 +1838,7 @@ trait Parsers requires SyntaxAnalyzer {
newmods = newmods | Flags.DEFERRED
EmptyTree
}
- for (val Pair(pos, name) <- lhs.toList) yield
+ for (val (pos, name) <- lhs.toList) yield
atPos(pos) { ValDef(newmods, name, tp.duplicate, rhs.duplicate) }
}
@@ -1965,12 +1965,12 @@ trait Parsers requires SyntaxAnalyzer {
implicitClassViews = implicitViewBuf.toList
//if (mods.hasFlag(Flags.CASE) && in.token != LPAREN) accept(LPAREN)
val constrAnnots = annotations()
- val Pair(constrMods, vparamss) =
- if (mods.hasFlag(Flags.TRAIT)) Pair(NoMods, List())
- else Pair(accessModifierOpt(),
+ val (constrMods, vparamss) =
+ if (mods.hasFlag(Flags.TRAIT)) (NoMods, List())
+ else (accessModifierOpt(),
paramClauses(name, implicitClassViews, mods.hasFlag(Flags.CASE)))
val thistpe = requiresTypeOpt()
- val Pair(self0, template) =
+ val (self0, template) =
classTemplate(mods, name, constrMods withAnnotations constrAnnots, vparamss)
val mods1 = if (mods.hasFlag(Flags.TRAIT) &&
(template.body forall treeInfo.isInterfaceMember))
@@ -1987,7 +1987,7 @@ trait Parsers requires SyntaxAnalyzer {
def objectDef(mods: Modifiers): ModuleDef =
atPos(in.skipToken()) {
val name = ident()
- val Pair(self, template0) = classTemplate(mods, name, NoMods, List())
+ val (self, template0) = classTemplate(mods, name, NoMods, List())
val template = self match {
case ValDef(mods, name, tpt, EmptyTree) if (name != nme.WILDCARD) =>
val vd = ValDef(mods, name, tpt, This(nme.EMPTY.toTypeName)) setPos self.pos
@@ -2003,7 +2003,7 @@ trait Parsers requires SyntaxAnalyzer {
* TraitTemplate ::= [extends MixinParents] [TemplateBody]
* MixinParents ::= AnnotType {with AnnotType}
*/
- def classTemplate(mods: Modifiers, name: Name, constrMods: Modifiers, vparamss: List[List[ValDef]]): Pair[ValDef, Template] = {
+ def classTemplate(mods: Modifiers, name: Name, constrMods: Modifiers, vparamss: List[List[ValDef]]): (ValDef, Template) = {
val pos = in.currentPos;
def acceptEmptyTemplateBody(msg: String): unit = {
if (in.token == LPAREN && settings.migrate.value)
@@ -2039,10 +2039,10 @@ trait Parsers requires SyntaxAnalyzer {
}
val ps = parents.toList
newLineOptWhenFollowedBy(LBRACE)
- val Pair(self, body) =
+ val (self, body) =
if (in.token == LBRACE) templateBody()
- else { acceptEmptyTemplateBody("`{' expected"); Pair(emptyValDef, List()) }
- Pair(self,
+ else { acceptEmptyTemplateBody("`{' expected"); (emptyValDef, List()) }
+ (self,
atPos(pos) {
if (!mods.hasFlag(Flags.TRAIT)) Template(ps, constrMods, vparamss, argss.toList, body)
else Template(ps, body)
@@ -2053,11 +2053,11 @@ trait Parsers requires SyntaxAnalyzer {
/** TemplateBody ::= [nl] `{' TemplateStatSeq `}'
*/
- def templateBody(): Pair[ValDef, List[Tree]] = {
+ def templateBody(): (ValDef, List[Tree]) = {
accept(LBRACE)
- val result @ Pair(self, stats) = templateStatSeq()
+ val result @ (self, stats) = templateStatSeq()
accept(RBRACE)
- if (stats.isEmpty) Pair(self, List(EmptyTree)) else result
+ if (stats.isEmpty) (self, List(EmptyTree)) else result
}
/** Refinement ::= [nl] `{' RefineStat {semi RefineStat} `}'
@@ -2122,7 +2122,7 @@ trait Parsers requires SyntaxAnalyzer {
* | Expr1
* |
*/
- def templateStatSeq(): Pair[ValDef, List[Tree]] = {
+ def templateStatSeq(): (ValDef, List[Tree]) = {
var self: ValDef = emptyValDef
val stats = new ListBuffer[Tree]
if (isExprIntro) {
@@ -2149,7 +2149,7 @@ trait Parsers requires SyntaxAnalyzer {
}
if (in.token != RBRACE && in.token != EOF) acceptStatSep()
}
- Pair(self, stats.toList)
+ (self, stats.toList)
}
/** RefineStatSeq ::= RefineStat {semi RefineStat}
diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
index 251d1a774f..e6efb6e76a 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
}
@@ -112,11 +112,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
}
@@ -265,7 +265,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)
@@ -390,7 +390,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 =>
@@ -415,13 +415,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/backend/icode/Checkers.scala b/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala
index e7a456aee6..f7dd446c0d 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Checkers.scala
@@ -209,7 +209,7 @@ abstract class Checkers {
* kind TypeKind.
*/
def checkBinop(kind: TypeKind) = {
- val Pair(a, b) = stack.pop2
+ val (a, b) = stack.pop2
checkType(a, kind)
checkType(b, kind)
}
@@ -269,11 +269,11 @@ abstract class Checkers {
case LOAD_ARRAY_ITEM(kind) =>
checkStack(2)
stack.pop2 match {
- case Pair(INT, ARRAY(elem)) =>
+ case (INT, ARRAY(elem)) =>
if (!(elem <:< kind))
typeError(kind, elem);
stack.push(elem);
- case Pair(a, b) =>
+ case (a, b) =>
error(" expected and INT and a array reference, but " +
a + ", " + b + " found");
}
@@ -302,12 +302,12 @@ abstract class Checkers {
case STORE_ARRAY_ITEM(kind) =>
checkStack(3);
stack.pop3 match {
- case Triple(k, INT, ARRAY(elem)) =>
+ case (k, INT, ARRAY(elem)) =>
if (!(k <:< kind))
typeError(kind, k);
if (!(k <:< elem))
typeError(elem, k);
- case Triple(a, b, c) =>
+ case (a, b, c) =>
error(" expected and array reference, and int and " + kind +
" but " + a + ", " + b + ", " + c + " found");
}
@@ -333,7 +333,7 @@ abstract class Checkers {
} else {
checkStack(2);
stack.pop2 match {
- case Pair(value, obj) =>
+ case (value, obj) =>
checkField(obj, field);
val fieldType = toTypeKind(field.tpe);
if (fieldType != SCALA_ALL_REF && !(value <:< fieldType))
@@ -378,7 +378,7 @@ abstract class Checkers {
case Shift(op, kind) =>
checkType(kind, BYTE, CHAR, SHORT, INT, LONG)
- val Pair(a, b) = stack.pop2
+ val (a, b) = stack.pop2
checkType(a, INT)
checkType(b, kind)
stack push kind
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index e60ea9a341..0abf72055f 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -484,14 +484,14 @@ abstract class GenICode extends SubComponent {
val kind = toTypeKind(tree.tpe)
var handlers = for (val CaseDef(pat, _, body) <- catches.reverse)
yield pat match {
- case Typed(Ident(nme.WILDCARD), tpt) => Triple(tpt.tpe.symbol, kind, {
+ case Typed(Ident(nme.WILDCARD), tpt) => (tpt.tpe.symbol, kind, {
ctx: Context =>
ctx.bb.emit(DROP(REFERENCE(tpt.tpe.symbol)));
val ctx1 = genLoad(body, ctx, kind);
genLoad(finalizer, ctx1, UNIT);
})
- case Ident(nme.WILDCARD) => Triple(definitions.ThrowableClass, kind, {
+ case Ident(nme.WILDCARD) => (definitions.ThrowableClass, kind, {
ctx: Context =>
ctx.bb.emit(DROP(REFERENCE(definitions.ThrowableClass)))
val ctx1 = genLoad(body, ctx, kind)
@@ -502,7 +502,7 @@ abstract class GenICode extends SubComponent {
val exception = new Local(pat.symbol, toTypeKind(pat.symbol.tpe), false)
ctx.method.addLocal(exception);
- Triple(pat.symbol.tpe.symbol, kind, {
+ (pat.symbol.tpe.symbol, kind, {
ctx: Context =>
ctx.bb.emit(STORE_LOCAL(exception), pat.pos);
val ctx1 = genLoad(body, ctx, kind);
@@ -511,7 +511,7 @@ abstract class GenICode extends SubComponent {
}
if (finalizer != EmptyTree)
- handlers = Triple(NoSymbol, kind, {
+ handlers = (NoSymbol, kind, {
ctx: Context =>
val exception = new Local(ctx.method.symbol
.newVariable(finalizer.pos, unit.fresh.newName("exc"))
@@ -747,7 +747,7 @@ abstract class GenICode extends SubComponent {
ctx1
}, List(
// tree.tpe / fun.tpe is object, which is no longer true after this transformation
- Triple(NoSymbol, expectedType, exhCtx => {
+ (NoSymbol, expectedType, exhCtx => {
exhCtx.bb.emit(LOAD_LOCAL(monitor))
exhCtx.bb.emit(MONITOR_EXIT(), tree.pos)
exhCtx.bb.emit(THROW())
@@ -1277,9 +1277,9 @@ abstract class GenICode extends SubComponent {
def genComparisonOp(l: Tree, r: Tree, code: Int): Unit = {
// special-case reference (in)equality test for null
if (code == scalaPrimitives.ID || code == scalaPrimitives.NI) {
- val expr: Tree = Pair(l, r) match {
- case Pair(Literal(Constant(null)), expr) => expr
- case Pair(expr, Literal(Constant(null))) => expr
+ val expr: Tree = (l, r) match {
+ case (Literal(Constant(null)), expr) => expr
+ case (expr, Literal(Constant(null))) => expr
case _ => null
}
if (expr ne null) {
@@ -1397,15 +1397,15 @@ abstract class GenICode extends SubComponent {
local
}
- Pair(l, r) match {
+ (l, r) match {
// null == expr -> expr eq null
- case Pair(Literal(Constant(null)), expr) =>
+ case (Literal(Constant(null)), expr) =>
val ctx1 = genLoad(expr, ctx, ANY_REF_CLASS)
ctx1.bb.emit(CZJUMP(thenCtx.bb, elseCtx.bb, EQ, ANY_REF_CLASS))
ctx1.bb.close
// expr == null -> if(expr eq null) true else expr.equals(null)
- case Pair(expr, Literal(Constant(null))) =>
+ case (expr, Literal(Constant(null))) =>
val eqEqTempLocal = getTempLocal
var ctx1 = genLoad(expr, ctx, ANY_REF_CLASS)
ctx1.bb.emit(DUP(ANY_REF_CLASS))
@@ -1804,15 +1804,15 @@ abstract class GenICode extends SubComponent {
*
* <code> ctx.Try( ctx => {
* ctx.bb.emit(...) // protected block
- * }, Pair(definitions.ThrowableClass,
+ * }, (definitions.ThrowableClass,
* ctx => {
* ctx.bb.emit(...); // exception handler
- * }), Pair(AnotherExceptionClass,
+ * }), (AnotherExceptionClass,
* ctx => {...
* } ))</code>
*/
def Try(body: Context => Context,
- handlers: List[Triple[Symbol, TypeKind, (Context => Context)]],
+ handlers: List[(Symbol, TypeKind, (Context => Context))],
finalizer: Tree) = {
val outerCtx = this.dup
val afterCtx = outerCtx.newBlock
diff --git a/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala b/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala
index a780a233d5..9b08ac20e7 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/ICodes.scala
@@ -73,7 +73,7 @@ abstract class ICodes extends AnyRef
succ.predecessors.length == 1;
succ.predecessors.head == b;
!(m.exh.contains { (e: ExceptionHandler) => e.covers(b) && !e.covers(succ) }))
- yield Pair(b, succ)
+ yield (b, succ)
()
}
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Members.scala b/src/compiler/scala/tools/nsc/backend/icode/Members.scala
index 654da7762e..f185c4c4b3 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Members.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Members.scala
@@ -77,7 +77,7 @@ trait Members requires ICodes {
/* This method applies the given function to each basic block. */
def traverseFeedBack(f: (BasicBlock, HashMap[BasicBlock, Boolean]) => Unit) = {
val visited : HashMap[BasicBlock, Boolean] = new HashMap;
- visited ++= blocks.elements.map(x => Pair(x, false));
+ visited ++= blocks.elements.map(x => (x, false));
var blockToVisit : List[BasicBlock] = startBlock::Nil;
@@ -243,7 +243,7 @@ trait Members requires ICodes {
var end: Int = _
/** PC-based ranges for this local variable's visibility */
- var ranges: List[Pair[Int, Int]] = Nil
+ var ranges: List[(Int, Int)] = Nil
override def equals(other: Any): Boolean = (
other.isInstanceOf[Local] &&
diff --git a/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala b/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala
index 00faaa19c8..1639b9fd12 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/TypeStacks.scala
@@ -52,12 +52,12 @@ trait TypeStacks requires ICodes {
/** Return the topmost two values on the stack. It assumes the stack
* is large enough. Topmost element first.
*/
- def pop2: Pair[TypeKind, TypeKind] = Pair(pop, pop)
+ def pop2: (TypeKind, TypeKind) = (pop, pop)
/** Return the topmost three values on the stack. It assumes the stack
* is large enough. Topmost element first.
*/
- def pop3: Triple[TypeKind, TypeKind, TypeKind] = Triple(pop, pop, pop)
+ def pop3: (TypeKind, TypeKind, TypeKind) = (pop, pop, pop)
/** Drop the first n elements of the stack. */
def pop(n: Int): Unit = types = types.drop(n)
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
index 36a2307212..71ca0959bd 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -203,7 +203,7 @@ abstract class GenJVM extends SubComponent {
}
def addExceptionsAttribute(sym: Symbol): Unit = {
- val Pair(excs, others) = sym.attributes.partition((a => a match {
+ val (excs, others) = sym.attributes.partition((a => a match {
case AttrInfo(ThrowsAttr, _, _) => true
case _ => false
}))
@@ -289,7 +289,7 @@ abstract class GenJVM extends SubComponent {
buf.putShort(cpool.addUtf8("value").toShort)
emitElement(consts.head)
}
- for (val Pair(name, value) <- nvPairs) {
+ for (val (name, value) <- nvPairs) {
buf.putShort(cpool.addUtf8(name.toString()).toShort)
emitElement(value)
}
@@ -583,9 +583,9 @@ abstract class GenJVM extends SubComponent {
* The intervals in the list have to be inclusive in the beginning and
* exclusive in the end: [start, end).
*/
- def ranges(e: ExceptionHandler): List[Pair[Int, Int]] = {
+ def ranges(e: ExceptionHandler): List[(Int, Int)] = {
var covered = e.covered
- var ranges: List[Pair[Int, Int]] = Nil
+ var ranges: List[(Int, Int)] = Nil
var start = -1
var end = -1
@@ -593,7 +593,7 @@ abstract class GenJVM extends SubComponent {
if (! (covered contains b) ) {
if (start >= 0) { // we're inside a handler range
end = labels(b).getAnchor()
- ranges = Pair(start, end) :: ranges
+ ranges = (start, end) :: ranges
start = -1
}
} else {
@@ -612,7 +612,7 @@ abstract class GenJVM extends SubComponent {
* code!
*/
if (start >= 0) {
- ranges = Pair(start, jcode.getPC()) :: ranges;
+ ranges = (start, jcode.getPC()) :: ranges;
}
if (covered != Nil)
@@ -989,10 +989,10 @@ abstract class GenJVM extends SubComponent {
case SCOPE_EXIT(lv) =>
if (varsInBlock contains lv) {
- lv.ranges = Pair(lv.start, jcode.getPC()) :: lv.ranges
+ lv.ranges = (lv.start, jcode.getPC()) :: lv.ranges
varsInBlock -= lv
} else if (b.varsInScope contains lv) {
- lv.ranges = Pair(labels(b).getAnchor(), jcode.getPC()) :: lv.ranges
+ lv.ranges = (labels(b).getAnchor(), jcode.getPC()) :: lv.ranges
b.varsInScope -= lv
} else
assert(false, "Illegal local var nesting: " + method)
@@ -1022,10 +1022,10 @@ abstract class GenJVM extends SubComponent {
// local vars that survived this basic block
for (val lv <- varsInBlock) {
- lv.ranges = Pair(lv.start, jcode.getPC()) :: lv.ranges
+ lv.ranges = (lv.start, jcode.getPC()) :: lv.ranges
}
for (val lv <- b.varsInScope) {
- lv.ranges = Pair(labels(b).getAnchor(), jcode.getPC()) :: lv.ranges
+ lv.ranges = (labels(b).getAnchor(), jcode.getPC()) :: lv.ranges
}
}
@@ -1101,67 +1101,67 @@ abstract class GenJVM extends SubComponent {
abort("Unknown arithmetic primitive " + primitive)
}
- case Logical(op, kind) => Pair(op, kind) match {
- case Pair(AND, LONG) =>
+ case Logical(op, kind) => (op, kind) match {
+ case (AND, LONG) =>
jcode.emitLAND()
- case Pair(AND, INT) =>
+ case (AND, INT) =>
jcode.emitIAND()
- case Pair(AND, _) =>
+ case (AND, _) =>
jcode.emitIAND()
if (kind != BOOL)
jcode.emitT2T(javaType(INT), javaType(kind));
- case Pair(OR, LONG) =>
+ case (OR, LONG) =>
jcode.emitLOR()
- case Pair(OR, INT) =>
+ case (OR, INT) =>
jcode.emitIOR()
- case Pair(OR, _) =>
+ case (OR, _) =>
jcode.emitIOR()
if (kind != BOOL)
jcode.emitT2T(javaType(INT), javaType(kind));
- case Pair(XOR, LONG) =>
+ case (XOR, LONG) =>
jcode.emitLXOR()
- case Pair(XOR, INT) =>
+ case (XOR, INT) =>
jcode.emitIXOR()
- case Pair(XOR, _) =>
+ case (XOR, _) =>
jcode.emitIXOR()
if (kind != BOOL)
jcode.emitT2T(javaType(INT), javaType(kind));
}
- case Shift(op, kind) => Pair(op, kind) match {
- case Pair(LSL, LONG) =>
+ case Shift(op, kind) => (op, kind) match {
+ case (LSL, LONG) =>
jcode.emitLSHL()
- case Pair(LSL, INT) =>
+ case (LSL, INT) =>
jcode.emitISHL()
- case Pair(LSL, _) =>
+ case (LSL, _) =>
jcode.emitISHL()
jcode.emitT2T(javaType(INT), javaType(kind))
- case Pair(ASR, LONG) =>
+ case (ASR, LONG) =>
jcode.emitLSHR()
- case Pair(ASR, INT) =>
+ case (ASR, INT) =>
jcode.emitISHR()
- case Pair(ASR, _) =>
+ case (ASR, _) =>
jcode.emitISHR()
jcode.emitT2T(javaType(INT), javaType(kind))
- case Pair(LSR, LONG) =>
+ case (LSR, LONG) =>
jcode.emitLUSHR()
- case Pair(LSR, INT) =>
+ case (LSR, INT) =>
jcode.emitIUSHR()
- case Pair(LSR, _) =>
+ case (LSR, _) =>
jcode.emitIUSHR()
jcode.emitT2T(javaType(INT), javaType(kind))
}
- case Comparison(op, kind) => Pair(op, kind) match {
- case Pair(CMP, LONG) => jcode.emitLCMP()
- case Pair(CMPL, FLOAT) => jcode.emitFCMPL()
- case Pair(CMPG, FLOAT) => jcode.emitFCMPG()
- case Pair(CMPL, DOUBLE) => jcode.emitDCMPL()
- case Pair(CMPG, DOUBLE) => jcode.emitDCMPL()
+ case Comparison(op, kind) => (op, kind) match {
+ case (CMP, LONG) => jcode.emitLCMP()
+ case (CMPL, FLOAT) => jcode.emitFCMPL()
+ case (CMPG, FLOAT) => jcode.emitFCMPG()
+ case (CMPL, DOUBLE) => jcode.emitDCMPL()
+ case (CMPG, DOUBLE) => jcode.emitDCMPL()
}
case Conversion(src, dst) =>
@@ -1449,7 +1449,7 @@ abstract class GenJVM extends SubComponent {
val index = indexOf(lv).asInstanceOf[Short]
val tpe = javaType(lv.kind).getSignature()
- for (val Pair(start, end) <- lv.ranges) {
+ for (val (start, end) <- lv.ranges) {
emitEntry(name, tpe, index, start.asInstanceOf[Short], (end - start).asInstanceOf[Short])
}
}
@@ -1463,10 +1463,10 @@ abstract class GenJVM extends SubComponent {
/** Merge adjacent ranges. */
- private def mergeEntries(ranges: List[Pair[Int, Int]]): List[Pair[Int, Int]] =
- (ranges.foldLeft(Nil: List[Pair[Int, Int]]) { (collapsed: List[Pair[Int, Int]], p: Pair[Int, Int]) => Pair(collapsed, p) match {
- case Pair(Nil, _) => List(p)
- case Pair(Pair(s1, e1) :: rest, Pair(s2, e2)) if (e1 == s2) => Pair(s1, e2) :: rest
+ private def mergeEntries(ranges: List[(Int, Int)]): List[(Int, Int)] =
+ (ranges.foldLeft(Nil: List[(Int, Int)]) { (collapsed: List[(Int, Int)], p: (Int, Int)) => (collapsed, p) match {
+ case (Nil, _) => List(p)
+ case ((s1, e1) :: rest, (s2, e2)) if (e1 == s2) => (s1, e2) :: rest
case _ => p :: collapsed
}}).reverse
diff --git a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
index 3623d125ea..8ffd4da396 100644
--- a/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
+++ b/src/compiler/scala/tools/nsc/backend/msil/GenMSIL.scala
@@ -322,7 +322,7 @@ abstract class GenMSIL extends SubComponent {
}
}
- def getAttributeArgs(consts: List[Constant], nvPairs: List[Pair[Name, Constant]]): Array[Byte] = {
+ def getAttributeArgs(consts: List[Constant], nvPairs: List[(Name, Constant)]): Array[Byte] = {
val buf = ByteBuffer.allocate(2048) // FIXME: this may be not enough!
buf.order(ByteOrder.LITTLE_ENDIAN)
buf.putShort(1.toShort) // signature
@@ -384,7 +384,7 @@ abstract class GenMSIL extends SubComponent {
consts foreach emitConst
buf.putShort(nvPairs.length.toShort)
- def emitNamedArg(nvPair: Pair[Name, Constant]): Unit = {
+ def emitNamedArg(nvPair: (Name, Constant)): Unit = {
// the named argument is a property of the attribute (it can't be a field, since
// all fields in scala are private)
buf.put(0x54.toByte)
@@ -881,18 +881,18 @@ abstract class GenMSIL extends SubComponent {
* returns: the output blocks plus an Option containing the possibly created
* new block
**/
- def adaptBlocks(blocks: List[BasicBlock], exh: ExceptionHandler): Pair[List[BasicBlock], Option[BasicBlock]] = {
+ def adaptBlocks(blocks: List[BasicBlock], exh: ExceptionHandler): (List[BasicBlock], Option[BasicBlock]) = {
def outsideTargets(block: BasicBlock, blocks: List[BasicBlock]) = {
block.successors.filter(scc => !blocks.contains(scc))
}
// get leaving blocks and their outside targets
- def leavingBlocks(blocks: List[BasicBlock]): List[Pair[BasicBlock, List[BasicBlock]]] = {
+ def leavingBlocks(blocks: List[BasicBlock]): List[(BasicBlock, List[BasicBlock])] = {
for {val b <- blocks
val t = outsideTargets(b, blocks)
- t.length != 0 } yield Pair(b, t)
+ t.length != 0 } yield (b, t)
}
- def replaceOutJumps(blocks: List[BasicBlock], leaving: List[Pair[BasicBlock, List[BasicBlock]]], exh: ExceptionHandler):Pair[List[BasicBlock], Option[BasicBlock]] = {
+ def replaceOutJumps(blocks: List[BasicBlock], leaving: List[(BasicBlock, List[BasicBlock])], exh: ExceptionHandler): (List[BasicBlock], Option[BasicBlock]) = {
def replaceJump(block: BasicBlock, from: BasicBlock, to: BasicBlock) = block.lastInstruction match {
case JUMP(where) =>
assert(from == where)
@@ -926,12 +926,12 @@ abstract class GenMSIL extends SubComponent {
val target = p._2(0) // the elemets of p._2 are all the same, checked before
replaceJump(lBlock, target, jumpOutBlock)
})
- Pair(blocks ::: List(jumpOutBlock), Some(jumpOutBlock))
+ (blocks ::: List(jumpOutBlock), Some(jumpOutBlock))
}
val leaving = leavingBlocks(blocks)
if (leaving.length == 0)
- Pair(blocks, None)
+ (blocks, None)
else if (leaving.length == 1) {
val outside = leaving(0)._2
assert(outside.forall(b => b == outside(0)), "exception-block leaving to multiple targets")
@@ -940,7 +940,7 @@ abstract class GenMSIL extends SubComponent {
else
assert(firstBlockAfter(exh) == outside(0), "try/catch leaving to multiple targets: " + firstBlockAfter(exh) + ", new: " + outside(0))
val last = leaving(0)._1
- Pair(blocks.diff(List(last)) ::: List(last), None)
+ (blocks.diff(List(last)) ::: List(last), None)
} else {
val outside = leaving.flatMap(p => p._2)
assert(outside.forall(b => b == outside(0)), "exception-block leaving to multiple targets")
@@ -968,7 +968,7 @@ abstract class GenMSIL extends SubComponent {
var singleAffectedHandler: ExceptionHandler = affectedHandlers(0) // List[ExceptionHandler] = Nil
var exceptionBlock: Option[ExceptionBlock] = None
affectedHandlers.foreach(h1 => {
- val Pair(adaptedBlocks, newBlock) = adaptBlocks(blocksToPut.intersect(h1.blocks), singleAffectedHandler)
+ val (adaptedBlocks, newBlock) = adaptBlocks(blocksToPut.intersect(h1.blocks), singleAffectedHandler)
newBlock match {
case Some(block) =>
blocksToPut = blocksToPut ::: List(block)
@@ -986,7 +986,7 @@ abstract class GenMSIL extends SubComponent {
val excBlock = currentBlock.addExceptionBlock(singleAffectedHandler)
exceptionBlock = Some(excBlock)
- val Pair(tryBlocks, newBlock) = adaptBlocks(blocksToPut.intersect(singleAffectedHandler.covered), singleAffectedHandler)
+ val (tryBlocks, newBlock) = adaptBlocks(blocksToPut.intersect(singleAffectedHandler.covered), singleAffectedHandler)
newBlock match {
case Some(block) =>
@@ -998,7 +998,7 @@ abstract class GenMSIL extends SubComponent {
addBlocks(tryBlocks)
if (singleAffectedHandler.finalizer != null && singleAffectedHandler.finalizer != NoFinalizer) {
- val Pair(blocks0, newBlock) = adaptBlocks(blocksToPut.intersect(singleAffectedHandler.finalizer.blocks), singleAffectedHandler)
+ val (blocks0, newBlock) = adaptBlocks(blocksToPut.intersect(singleAffectedHandler.finalizer.blocks), singleAffectedHandler)
newBlock match {
case Some(block) =>
blocksToPut = blocksToPut ::: List(block)
@@ -1379,13 +1379,13 @@ abstract class GenMSIL extends SubComponent {
}
// method: implicit view(FunctionX[PType0, PType1, ...,PTypeN, ResType]):DelegateType
- val Triple(isDelegateView, paramType, resType) = atPhase(currentRun.typerPhase){
+ val (isDelegateView, paramType, resType) = atPhase(currentRun.typerPhase){
msym.tpe match {
case MethodType(parameterTypes, resultType)
if (parameterTypes.length == 1 && msym.name == nme.view_) =>
val isDel = definitions.isCorrespondingDelegate(resultType, parameterTypes(0))
- Triple(isDel, parameterTypes(0), resultType)
- case _ => Triple(false, null, null)
+ (isDel, parameterTypes(0), resultType)
+ case _ => (false, null, null)
}
}
if (doEmit && isDelegateView) {
@@ -2206,8 +2206,8 @@ abstract class GenMSIL extends SubComponent {
// create the static caller method and the delegate object
- val Pair(paramTypes, returnType) = delegateType.member(nme.apply).tpe match {
- case MethodType(delParams, delReturn) => Pair(delParams, delReturn)
+ val (paramTypes, returnType) = delegateType.member(nme.apply).tpe match {
+ case MethodType(delParams, delReturn) => (delParams, delReturn)
case _ => abort("not a delegate type: " + delegateType)
}
val caller: MethodBuilder = delegateCallers.DefineMethod(
diff --git a/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala
index 354bf647a8..8b7fa9a3f3 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/ClosureElimination.scala
@@ -53,20 +53,20 @@ abstract class ClosureElimination extends SubComponent {
/** A simple peephole optimizer. */
val peephole = new PeepholeOpt( (i1, i2) =>
- Pair(i1, i2) match {
- case Pair(CONSTANT(c), DROP(_)) =>
+ (i1, i2) match {
+ case (CONSTANT(c), DROP(_)) =>
if (c.tag == UnitTag)
Some(List(i2))
else
Some(Nil);
- case Pair(LOAD_LOCAL(x), STORE_LOCAL(y)) =>
+ case (LOAD_LOCAL(x), STORE_LOCAL(y)) =>
if (x eq y) Some(Nil) else None
- case Pair(LOAD_LOCAL(_), DROP(_)) =>
+ case (LOAD_LOCAL(_), DROP(_)) =>
Some(Nil)
- case Pair(LOAD_FIELD(sym, isStatic), DROP(_)) =>
+ case (LOAD_FIELD(sym, isStatic), DROP(_)) =>
if (isStatic)
Some(Nil)
else
diff --git a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
index 8b987cdf79..152d33354e 100644
--- a/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
+++ b/src/compiler/scala/tools/nsc/backend/opt/DeadCodeElimination.scala
@@ -51,7 +51,7 @@ abstract class DeadCodeElimination extends SubComponent {
a.run;
for (val bb <- m.code.blocks.toList;
- val Pair(i, pos) <- bb.toList.zipWithIndex.reverse) {
+ val (i, pos) <- bb.toList.zipWithIndex.reverse) {
var live = a.out(bb);
i match {
diff --git a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala
index 3944e1444d..744e9f9a45 100644
--- a/src/compiler/scala/tools/nsc/doc/DocGenerator.scala
+++ b/src/compiler/scala/tools/nsc/doc/DocGenerator.scala
@@ -105,7 +105,7 @@ abstract class DocGenerator extends Models {
val n = tpe.typeArgs.length
if (n > 0) {
if (definitions.isFunctionType(tpe)) {
- val Pair(ts, List(r)) = tpe.typeArgs.splitAt(n-1)
+ val (ts, List(r)) = tpe.typeArgs.splitAt(n-1)
Text("(") ++ (
if (ts.isEmpty) NodeSeq.Empty
else
@@ -318,7 +318,7 @@ abstract class DocGenerator extends Models {
if (!args.isEmpty)
buf.append(args.map(.escapedStringValue).mkString("(", ",", ")"))
if (!nvPairs.isEmpty)
- for (val Pair(Pair(name, value), index) <- nvPairs.zipWithIndex) {
+ for (val ((name, value), index) <- nvPairs.zipWithIndex) {
if (index > 0)
buf.append(", ")
buf.append(name).append(" = ").append(value)
@@ -509,9 +509,9 @@ abstract class DocGenerator extends Models {
def fullComment(mmbr: HasTree): NodeSeq = {
val sym = mmbr.tree.symbol
- val Pair(sym1, kind1) =
- if (sym.isPrimaryConstructor) Pair(sym.owner, CONSTRUCTOR)
- else Pair(sym, if (sym.isConstructor) DEF else kindOf(mmbr.tree))
+ val (sym1, kind1) =
+ if (sym.isPrimaryConstructor) (sym.owner, CONSTRUCTOR)
+ else (sym, if (sym.isConstructor) DEF else kindOf(mmbr.tree))
comments.get(sym1) match {
case Some(text) => comment(text, false, kind1)
case None => NodeSeq.Empty
@@ -739,8 +739,8 @@ abstract class DocGenerator extends Models {
val decls = sym.tpe.decls.toList
//compute table members once for each relevant kind
val tables = for (val k <- kinds.keys.toList)
- yield Pair(k, decls filter kinds(k))
- for (val Pair(k, members) <- tables; !members.isEmpty) yield
+ yield (k, decls filter kinds(k))
+ for (val (k, members) <- tables; !members.isEmpty) yield
<table cellpadding="3" class="member" summary="">
<tr>
<td colspan="2" class="title">{k} Summary</td>
@@ -1202,7 +1202,7 @@ abstract class DocGenerator extends Models {
assert(comment0 endsWith JDOC_END)
comment0 = comment0.substring(0, comment0.length() - JDOC_END.length())
val buf = new StringBuilder
- type AttrDescr = Triple[String, String, StringBuilder]
+ type AttrDescr = (String, String, StringBuilder)
val attributes = new ListBuffer[AttrDescr]
var attr: AttrDescr = null
val tok = new StringTokenizer(comment0, LINE_SEPARATOR)
@@ -1210,12 +1210,12 @@ abstract class DocGenerator extends Models {
val s = tok.nextToken.replaceFirst("\\p{Space}?\\*", "")
val mat1 = pat1.matcher(s)
if (mat1.matches) {
- attr = Triple(mat1.group(1), null, new StringBuilder(mat1.group(2)))
+ attr = (mat1.group(1), null, new StringBuilder(mat1.group(2)))
if (kind != CONSTRUCTOR) attributes += attr
} else {
val mat2 = pat2.matcher(s)
if (mat2.matches) {
- attr = Triple(mat2.group(1), mat2.group(2), new StringBuilder(mat2.group(3)))
+ attr = (mat2.group(1), mat2.group(2), new StringBuilder(mat2.group(3)))
if (kind != CLASS) attributes += attr
} else if (attr ne null)
attr._3.append(s + LINE_SEPARATOR)
@@ -1223,15 +1223,15 @@ abstract class DocGenerator extends Models {
buf.append(s + LINE_SEPARATOR)
}
}
- val exceptions = new TreeMap[String, Pair[Symbol, String]] +
+ val exceptions = new TreeMap[String, (Symbol, String)] +
"Predef.IndexOutOfBoundsException" ->
- Pair(definitions.PredefModule, "IndexOutOfBoundsException") +
+ (definitions.PredefModule, "IndexOutOfBoundsException") +
"Predef.NoSuchElementException" ->
- Pair(definitions.PredefModule, "NoSuchElementException") +
+ (definitions.PredefModule, "NoSuchElementException") +
"Predef.NullPointerException" ->
- Pair(definitions.PredefModule, "NullPointerException") +
+ (definitions.PredefModule, "NullPointerException") +
"Predef.UnsupportedOperationException" ->
- Pair(definitions.PredefModule, "UnsupportedOperationException")
+ (definitions.PredefModule, "UnsupportedOperationException")
val body = buf.toString
if (isShort)
<span>{parse(body)}</span>;
@@ -1247,7 +1247,7 @@ abstract class DocGenerator extends Models {
else if (attr._1.equals("throws"))
<code>{ exceptions.get(attr._2) match {
case Some(p) =>
- val Pair(sym, s) = p
+ val (sym, s) = p
val path = "../" //todo: fix path
val href = path + sym.fullNameString('/') +
(if (sym.isModule || sym.isModuleClass) NAME_SUFFIX_OBJECT else "") +
diff --git a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
index 75ab5623fd..bed3aed1fe 100644
--- a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
+++ b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
@@ -1044,7 +1044,7 @@ print()
//Console.println("sel:"+selector+" last"+lastSelector+" - "+(selector == lastSelector))
val next = _h.next;
//res = And(mkNegate(res), toTree(node.or, selector));
- val Triple(doOptimize, coveredCases, remainingCases) = _h.optimize1()
+ val (doOptimize, coveredCases, remainingCases) = _h.optimize1()
if(!remainingCases.isEmpty && doCheckExhaustive) {
carryCovered = carryCovered ++ coveredCases // ??
if(next != null && next.or.and.isUnguardedBody) {
@@ -1296,12 +1296,12 @@ print()
toTree(node.or, selector.duplicate))
case ConstrPat(casted) =>
- def outerAlwaysEqual(left: Type, right: Type) = Pair(left,right) match {
- case Pair(TypeRef(lprefix, _,_), TypeRef(rprefix,_,_)) if lprefix =:= rprefix =>
+ def outerAlwaysEqual(left: Type, right: Type) = (left,right) match {
+ case (TypeRef(lprefix, _,_), TypeRef(rprefix,_,_)) if lprefix =:= rprefix =>
true
case _ =>
if(settings.XprintOuterMatches.value)
- cunit.warning(node.pos, "can't be sure statically that these outers are equal:"+Pair(left,right).toString)
+ cunit.warning(node.pos, "can't be sure statically that these outers are equal:"+(left,right).toString)
false
}
diff --git a/src/compiler/scala/tools/nsc/matching/PatternNodes.scala b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala
index b436dccefb..ad1a32674f 100644
--- a/src/compiler/scala/tools/nsc/matching/PatternNodes.scala
+++ b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala
@@ -327,16 +327,16 @@ trait PatternNodes requires transform.ExplicitOuter {
/** returns true if this tree is optimizable
* throws a warning if is not exhaustive
*/
- def optimize1(): Triple[Boolean, SymSet, SymSet] = {
+ def optimize1(): (Boolean, SymSet, SymSet) = {
import symtab.Flags
val selType = this.getTpe
if (!isSubType(selType, definitions.ScalaObjectClass.tpe))
- return Triple(false, null, emptySymbolSet)
+ return (false, null, emptySymbolSet)
if(this.or eq null)
- return Triple(false, null, emptySymbolSet) // only case _
+ return (false, null, emptySymbolSet) // only case _
def checkExCoverage(tpesym:Symbol): SymSet =
if(!tpesym.hasFlag(Flags.SEALED)) emptySymbolSet
@@ -409,7 +409,7 @@ trait PatternNodes requires transform.ExplicitOuter {
}
this.forEachBranch(traverse)
- return Triple(res && (cases > 2), coveredCases, remainingCases)
+ return (res && (cases > 2), coveredCases, remainingCases)
} // def optimize
}
diff --git a/src/compiler/scala/tools/nsc/matching/TransMatcher.scala b/src/compiler/scala/tools/nsc/matching/TransMatcher.scala
index 433a33f3a7..8fa8bb6437 100644
--- a/src/compiler/scala/tools/nsc/matching/TransMatcher.scala
+++ b/src/compiler/scala/tools/nsc/matching/TransMatcher.scala
@@ -163,7 +163,7 @@ with PatternMatchers */ {
*
* case .. () .. => val x = Nil; body
*/
- def isRegular(pats: List[CaseDef]): Pair[List[CaseDef],Boolean] = {
+ def isRegular(pats: List[CaseDef]): (List[CaseDef],Boolean) = {
var existsReg = false
var isReg = false
var nilVars: List[Symbol] = null
@@ -273,7 +273,7 @@ with PatternMatchers */ {
res = copy.CaseDef(cdef, newt, cdef.guard, nbody) :: res
}
- Pair(res.reverse, existsReg)
+ (res.reverse, existsReg)
}
/** handles all translation of pattern matching
@@ -284,7 +284,7 @@ with PatternMatchers */ {
//
// 1. is there a regular pattern?
- val Pair(cases, containsReg) = isRegular(ocases)
+ val (cases, containsReg) = isRegular(ocases)
// @todo: remove unused variables
diff --git a/src/compiler/scala/tools/nsc/models/SemanticTokens.scala b/src/compiler/scala/tools/nsc/models/SemanticTokens.scala
index 52934c95fc..a61e9ae549 100644
--- a/src/compiler/scala/tools/nsc/models/SemanticTokens.scala
+++ b/src/compiler/scala/tools/nsc/models/SemanticTokens.scala
@@ -67,7 +67,7 @@ class SemanticTokens(val compiler: Global) {
}
abstract class Actual extends HasNext with HasPrev {
- def convertToGap: Pair[Int, Actual] = {
+ def convertToGap: (Int, Actual) = {
val nextGap = next.isInstanceOf[Gap]
val prevGap = prev.isInstanceOf[Gap]
@@ -83,21 +83,21 @@ class SemanticTokens(val compiler: Global) {
gap.next0 = next
next.prev0 = gap
}
- new Pair(ret, gap)
+ (ret, gap)
}
else if (nextGap) {
val gap = next.asInstanceOf[Gap]
gap.setLength(gap.length + length)
gap.prev0 = prev
prev.next0 = gap
- new Pair(0, gap)
+ (0, gap)
}
else {
prev.next0 = next
next.prev0 = prev
val gap = new Gap(prev)
gap.setLength(length)
- new Pair(0, gap)
+ (0, gap)
}
}
@@ -122,7 +122,7 @@ class SemanticTokens(val compiler: Global) {
def setLength(length1: Int) = length0 = length1
// already gap
- override def convertToGap: Pair[Int,Actual] = new Pair(0, this)
+ override def convertToGap: (Int,Actual) = (0, this)
}
def Process(unit: CompilationUnit) = new Process(unit)
diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
index 7f2f08a495..8467bcb302 100644
--- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala
@@ -45,7 +45,7 @@ trait Definitions requires SymbolTable {
var DelegateClass: Symbol = _ // System.MulticastDelegate
var Delegate_scalaCallers: List[Symbol] = List()
// Symbol -> (Symbol, Type): scalaCaller -> (scalaMethodSym, DelegateType)
- // var Delegate_scalaCallerInfos: HashMap[Symbol, Pair[Symbol, Type]] = _
+ // var Delegate_scalaCallerInfos: HashMap[Symbol, (Symbol, Type)] = _
var Delegate_scalaCallerTargets: HashMap[Symbol, Symbol] = _
// the scala value classes
@@ -921,7 +921,7 @@ trait Definitions requires SymbolTable {
// def addScalaCallerInfo(scalaCaller: Symbol, methSym: Symbol, delType: Type) = {
// assert(Delegate_scalaCallers contains scalaCaller)
- // Delegate_scalaCallerInfos += scalaCaller -> Pair(methSym, delType)
+ // Delegate_scalaCallerInfos += scalaCaller -> (methSym, delType)
// }
def addScalaCallerInfo(scalaCaller: Symbol, methSym: Symbol) = {
diff --git a/src/compiler/scala/tools/nsc/symtab/StdNames.scala b/src/compiler/scala/tools/nsc/symtab/StdNames.scala
index a621cab408..8ab60f8459 100644
--- a/src/compiler/scala/tools/nsc/symtab/StdNames.scala
+++ b/src/compiler/scala/tools/nsc/symtab/StdNames.scala
@@ -89,6 +89,8 @@ trait StdNames requires SymbolTable {
def isLocalName(name: Name) = name.endsWith(LOCAL_SUFFIX)
def isSetterName(name: Name) = name.endsWith(SETTER_SUFFIX)
def isLocalDummyName(name: Name) = name.startsWith(LOCALDUMMY_PREFIX)
+ def isOpAssignmentName(name: Name) =
+ name.endsWith(nme.EQL) && name != nme.EQEQ && !name.endsWith(nme.USCOREEQL)
/** If `name' is an expandedName, the original name. Otherwise `name' itself.
* @see Symbol.expandedName
@@ -182,6 +184,8 @@ trait StdNames requires SymbolTable {
val AMPAMP = encode("&&")
val COLONCOLON = encode("::")
val PERCENT = encode("%")
+ val EQL = encode("=")
+ val USCOREEQL = encode("_=")
val Nothing = newTermName("Nothing")
val Null = newTermName("Null")
diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
index 8fe03975f3..25fc9448d3 100644
--- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
+++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
@@ -174,7 +174,7 @@ abstract class SymbolLoaders {
}
// 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 {
@@ -184,7 +184,7 @@ abstract class SymbolLoaders {
enterClassAndModule(name, loader)
}
- for (val Pair(name, file) <- packages.elements)
+ for (val (name, file) <- packages.elements)
enterPackage(name, newPackageLoader(file))
}
}
@@ -228,7 +228,7 @@ abstract class SymbolLoaders {
}
// import the CLR types contained in the package (namespace)
- for (val Pair(name, typ) <- types.elements) {
+ for (val (name, typ) <- types.elements) {
assert(namespace == typ.Namespace, typ.FullName);
if (typ.IsDefined(clrTypes.SCALA_SYMTAB_ATTR, false)) {
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
index 66d1913608..f0b18dc5ab 100644
--- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala
@@ -1309,13 +1309,13 @@ trait Symbols requires SymbolTable {
def cloneSymbolImpl(owner: Symbol): Symbol = throw new Error()
}
- case class AttrInfo(atp: Type, args: List[Constant], assocs: List[Pair[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("(", ", ", ")")) +
(if (assocs.isEmpty) ""
- else (assocs map { case Pair(x, y) => x+" = "+y } mkString ("{", ", ", "}")))
+ else (assocs map { case (x, y) => x+" = "+y } mkString ("{", ", ", "}")))
}
def cloneSymbols(syms: List[Symbol]): List[Symbol] = {
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 163683401a..4e887d93ed 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -918,7 +918,7 @@ trait Types requires SymbolTable {
def apply(tp: Type): Type = {
tp match {
case TypeRef(_, sym, args) =>
- for (val Pair(tparam1, arg) <- sym.info.typeParams zip args)
+ for (val (tparam1, arg) <- sym.info.typeParams zip args)
if (arg contains tparam) {
addRef(NonExpansive, tparam, tparam1)
if (arg.symbol != tparam) addRef(Expansive, tparam, tparam1)
@@ -943,7 +943,7 @@ trait Types requires SymbolTable {
val lastRefs = Array(refs(0), refs(1))
state = Initialized
var change = false
- for (val Pair(from, targets) <- refs(NonExpansive).elements)
+ for (val (from, targets) <- refs(NonExpansive).elements)
for (val target <- targets) {
var thatInfo = classInfo(target)
if (thatInfo.state != Initialized)
@@ -951,7 +951,7 @@ trait Types requires SymbolTable {
addRefs(NonExpansive, from, thatInfo.getRefs(NonExpansive, target))
addRefs(Expansive, from, thatInfo.getRefs(Expansive, target))
}
- for (val Pair(from, targets) <- refs(Expansive).elements)
+ for (val (from, targets) <- refs(Expansive).elements)
for (val target <- targets) {
var thatInfo = classInfo(target)
addRefs(Expansive, from, thatInfo.getRefs(NonExpansive, target))
@@ -2012,40 +2012,40 @@ trait Types requires SymbolTable {
* equivalent types.
*/
def isSameType(tp1: Type, tp2: Type): boolean = {
- Pair(tp1, tp2) match {
- case Pair(ErrorType, _) => true
- case Pair(WildcardType, _) => true
- case Pair(_, ErrorType) => true
- case Pair(_, WildcardType) => true
-
- case Pair(NoType, _) => false
- case Pair(NoPrefix, _) => tp2.symbol.isPackageClass
- case Pair(_, NoType) => false
- case Pair(_, NoPrefix) => tp1.symbol.isPackageClass
-
- case Pair(ThisType(sym1), ThisType(sym2))
+ (tp1, tp2) match {
+ case (ErrorType, _) => true
+ case (WildcardType, _) => true
+ case (_, ErrorType) => true
+ case (_, WildcardType) => true
+
+ case (NoType, _) => false
+ case (NoPrefix, _) => tp2.symbol.isPackageClass
+ case (_, NoType) => false
+ case (_, NoPrefix) => tp1.symbol.isPackageClass
+
+ case (ThisType(sym1), ThisType(sym2))
if (sym1 == sym2) =>
true
- case Pair(SingleType(pre1, sym1), SingleType(pre2, sym2))
+ case (SingleType(pre1, sym1), SingleType(pre2, sym2))
if ((sym1 == sym2) && (pre1 =:= pre2)) =>
true
/*
- case Pair(SingleType(pre1, sym1), ThisType(sym2))
+ case (SingleType(pre1, sym1), ThisType(sym2))
if (sym1.isModule &&
sym1.moduleClass == sym2 &&
pre1 =:= sym2.owner.thisType) =>
true
- case Pair(ThisType(sym1), SingleType(pre2, sym2))
+ case (ThisType(sym1), SingleType(pre2, sym2))
if (sym2.isModule &&
sym2.moduleClass == sym1 &&
pre2 =:= sym1.owner.thisType) =>
true
*/
- case Pair(ConstantType(value1), ConstantType(value2)) =>
+ case (ConstantType(value1), ConstantType(value2)) =>
value1 == value2
- case Pair(TypeRef(pre1, sym1, args1), TypeRef(pre2, sym2, args2)) =>
+ case (TypeRef(pre1, sym1, args1), TypeRef(pre2, sym2, args2)) =>
sym1 == sym2 && (phase.erasedTypes || pre1 =:= pre2) && isSameTypes(args1, args2)
- case Pair(RefinedType(parents1, ref1), RefinedType(parents2, ref2)) =>
+ case (RefinedType(parents1, ref1), RefinedType(parents2, ref2)) =>
def isSubScope(s1: Scope, s2: Scope): boolean = s2.toList.forall {
sym2 =>
val sym1 = s1.lookup(sym2.name)
@@ -2054,31 +2054,31 @@ trait Types requires SymbolTable {
}
//Console.println("is same? " + tp1 + " " + tp2 + " " + tp1.symbol.owner + " " + tp2.symbol.owner)//DEBUG
isSameTypes(parents1, parents2) && isSubScope(ref1, ref2) && isSubScope(ref2, ref1)
- case Pair(MethodType(pts1, res1), MethodType(pts2, res2)) =>
+ case (MethodType(pts1, res1), MethodType(pts2, res2)) =>
(pts1.length == pts2.length &&
isSameTypes(pts1, pts2) &&
res1 =:= res2 &&
tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType])
- case Pair(PolyType(tparams1, res1), PolyType(tparams2, res2)) =>
+ case (PolyType(tparams1, res1), PolyType(tparams2, res2)) =>
(tparams1.length == tparams2.length &&
List.forall2(tparams1, tparams2)
((p1, p2) => p1.info =:= p2.info.substSym(tparams2, tparams1)) &&
res1 =:= res2.substSym(tparams2, tparams1))
- case Pair(TypeBounds(lo1, hi1), TypeBounds(lo2, hi2)) =>
+ case (TypeBounds(lo1, hi1), TypeBounds(lo2, hi2)) =>
lo1 =:= lo2 && hi1 =:= hi2
- case Pair(BoundedWildcardType(bounds), _) =>
+ case (BoundedWildcardType(bounds), _) =>
bounds containsType tp2
- case Pair(_, BoundedWildcardType(bounds)) =>
+ case (_, BoundedWildcardType(bounds)) =>
bounds containsType tp1
- case Pair(TypeVar(_, constr1), _) =>
+ case (TypeVar(_, constr1), _) =>
if (constr1.inst != NoType) constr1.inst =:= tp2
else constr1 instantiate (wildcardToTypeVarMap(tp2))
- case Pair(_, TypeVar(_, constr2)) =>
+ case (_, TypeVar(_, constr2)) =>
if (constr2.inst != NoType) tp1 =:= constr2.inst
else constr2 instantiate (wildcardToTypeVarMap(tp1))
- case Pair(AttributedType(_,atp), _) =>
+ case (AttributedType(_,atp), _) =>
isSameType(atp, tp2)
- case Pair(_, AttributedType(_,atp)) =>
+ case (_, AttributedType(_,atp)) =>
isSameType(tp1, atp)
case _ =>
if (tp1.isStable && tp2.isStable) {
@@ -2127,24 +2127,24 @@ trait Types requires SymbolTable {
* @return ...
*/
def isSubType0(tp1: Type, tp2: Type): boolean = {
- Pair(tp1, tp2) match {
- case Pair(ErrorType, _) => true
- case Pair(WildcardType, _) => true
- case Pair(_, ErrorType) => true
- case Pair(_, WildcardType) => true
-
- case Pair(NoType, _) => false
- case Pair(NoPrefix, _) => tp2.symbol.isPackageClass
- case Pair(_, NoType) => false
- case Pair(_, NoPrefix) => tp1.symbol.isPackageClass
-
- case Pair(ThisType(_), ThisType(_)) => tp1 =:= tp2
- case Pair(ThisType(_), SingleType(_, _)) => tp1 =:= tp2
- case Pair(SingleType(_, _), ThisType(_)) => tp1 =:= tp2
- case Pair(SingleType(_, _), SingleType(_, _)) => tp1 =:= tp2
- case Pair(ConstantType(_), ConstantType(_)) => tp1 =:= tp2
-
- case Pair(TypeRef(pre1, sym1, args1), TypeRef(pre2, sym2, args2)) =>
+ (tp1, tp2) match {
+ case (ErrorType, _) => true
+ case (WildcardType, _) => true
+ case (_, ErrorType) => true
+ case (_, WildcardType) => true
+
+ case (NoType, _) => false
+ case (NoPrefix, _) => tp2.symbol.isPackageClass
+ case (_, NoType) => false
+ case (_, NoPrefix) => tp1.symbol.isPackageClass
+
+ case (ThisType(_), ThisType(_)) => tp1 =:= tp2
+ case (ThisType(_), SingleType(_, _)) => tp1 =:= tp2
+ case (SingleType(_, _), ThisType(_)) => tp1 =:= tp2
+ case (SingleType(_, _), SingleType(_, _)) => tp1 =:= tp2
+ case (ConstantType(_), ConstantType(_)) => tp1 =:= tp2
+
+ case (TypeRef(pre1, sym1, args1), TypeRef(pre2, sym2, args2)) =>
//Console.println("isSubType " + tp1 + " " + tp2);//DEBUG
def isSubArgs(tps1: List[Type], tps2: List[Type],
tparams: List[Symbol]): boolean = (
@@ -2172,50 +2172,50 @@ trait Types requires SymbolTable {
||
// Console.println("last chance " + sym1 + " " + sym2 + " " + sym2.isClass + " " (sym2 isSubClass ObjectClass))
sym1 == AllRefClass && sym2.isClass && sym2 != AllClass && (sym2 isSubClass ObjectClass))
- case Pair(MethodType(pts1, res1), MethodType(pts2, res2)) =>
+ case (MethodType(pts1, res1), MethodType(pts2, res2)) =>
(pts1.length == pts2.length &&
matchingParams(pts1, pts2, tp2.isInstanceOf[JavaMethodType]) &&
(res1 <:< res2) &&
tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType])
- case Pair(PolyType(tparams1, res1), PolyType(tparams2, res2)) =>
+ case (PolyType(tparams1, res1), PolyType(tparams2, res2)) =>
(tparams1.length == tparams2.length &&
List.forall2(tparams1, tparams2)
((p1, p2) => p2.info.substSym(tparams2, tparams1) <:< p1.info) &&
res1 <:< res2.substSym(tparams2, tparams1))
- case Pair(TypeBounds(lo1, hi1), TypeBounds(lo2, hi2)) =>
+ case (TypeBounds(lo1, hi1), TypeBounds(lo2, hi2)) =>
lo2 <:< lo1 && hi1 <:< hi2
- case Pair(BoundedWildcardType(bounds), _) =>
+ case (BoundedWildcardType(bounds), _) =>
bounds.lo <:< tp2
- case Pair(_, BoundedWildcardType(bounds)) =>
+ case (_, BoundedWildcardType(bounds)) =>
tp1 <:< bounds.hi
- case Pair(_, TypeVar(_, constr2)) =>
+ case (_, TypeVar(_, constr2)) =>
if (constr2.inst != NoType) tp1 <:< constr2.inst
else { constr2.lobounds = tp1 :: constr2.lobounds; true }
- case Pair(TypeVar(_, constr1), _) =>
+ case (TypeVar(_, constr1), _) =>
if (constr1.inst != NoType) constr1.inst <:< tp2
else { constr1.hibounds = tp2 :: constr1.hibounds; true }
- case Pair(AttributedType(_,atp1), _) =>
+ case (AttributedType(_,atp1), _) =>
atp1 <:< tp2
- case Pair(_, AttributedType(_,atp2)) =>
+ case (_, AttributedType(_,atp2)) =>
tp1 <:< atp2
- case Pair(_, TypeRef(pre2, sym2, args2))
+ case (_, TypeRef(pre2, sym2, args2))
if sym2.isAbstractType && !(tp2 =:= tp2.bounds.lo) && (tp1 <:< tp2.bounds.lo) =>
true
- case Pair(_, RefinedType(parents2, ref2)) =>
+ case (_, RefinedType(parents2, ref2)) =>
(parents2 forall tp1.<:<) && (ref2.toList forall tp1.specializes) &&
(!parents2.exists(.symbol.isAbstractType) || tp1.symbol != AllRefClass)
- case Pair(RefinedType(parents1, ref1), _) =>
+ case (RefinedType(parents1, ref1), _) =>
parents1 exists (.<:<(tp2))
/* todo: replace following with
- case Pair(ThisType(_), _)
+ case (ThisType(_), _)
| {SingleType(_, _), _}
| {ConstantType(_), _} =>
once patern matching bug is fixed */
- case Pair(ThisType(_), _) => tp1.singleDeref <:< tp2
- case Pair(SingleType(_, _), _) => tp1.singleDeref <:< tp2
- case Pair(ConstantType(_), _) => tp1.singleDeref <:< tp2
+ case (ThisType(_), _) => tp1.singleDeref <:< tp2
+ case (SingleType(_, _), _) => tp1.singleDeref <:< tp2
+ case (ConstantType(_), _) => tp1.singleDeref <:< tp2
- case Pair(TypeRef(pre1, sym1, args1), _) =>
+ case (TypeRef(pre1, sym1, args1), _) =>
(sym1 == AllClass && tp2 <:< AnyClass.tpe
||
sym1 == AllRefClass && tp2.isInstanceOf[SingletonType] && (tp1 <:< tp2.widen))
@@ -2260,21 +2260,21 @@ trait Types requires SymbolTable {
}
/** A function implementing <code>tp1</code> matches <code>tp2</code> */
- private def matchesType(tp1: Type, tp2: Type): boolean = Pair(tp1, tp2) match {
- case Pair(MethodType(pts1, res1), MethodType(pts2, res2)) =>
+ private def matchesType(tp1: Type, tp2: Type): boolean = (tp1, tp2) match {
+ case (MethodType(pts1, res1), MethodType(pts2, res2)) =>
(matchingParams(pts1, pts2, tp2.isInstanceOf[JavaMethodType]) && (res1 matches res2) &&
tp1.isInstanceOf[ImplicitMethodType] == tp2.isInstanceOf[ImplicitMethodType])
- case Pair(PolyType(tparams1, res1), PolyType(tparams2, res2)) =>
+ case (PolyType(tparams1, res1), PolyType(tparams2, res2)) =>
(tparams1.length == tparams2.length &&
(res1 matches res2.substSym(tparams2, tparams1)))
- case Pair(PolyType(List(), rtp1), MethodType(List(), rtp2)) => matchesType(rtp1, rtp2)
- case Pair(MethodType(List(), rtp1), PolyType(List(), rtp2)) => matchesType(rtp1, rtp2)
- case Pair(PolyType(List(), rtp1), _) => matchesType(rtp1, tp2)
- case Pair(_, PolyType(List(), rtp2)) => matchesType(tp1, rtp2)
- case Pair(MethodType(_, _), _) => false
- case Pair(PolyType(_, _), _) => false
- case Pair(_, MethodType(_, _)) => false
- case Pair(_, PolyType(_, _)) => false
+ case (PolyType(List(), rtp1), MethodType(List(), rtp2)) => matchesType(rtp1, rtp2)
+ case (MethodType(List(), rtp1), PolyType(List(), rtp2)) => matchesType(rtp1, rtp2)
+ case (PolyType(List(), rtp1), _) => matchesType(rtp1, tp2)
+ case (_, PolyType(List(), rtp2)) => matchesType(tp1, rtp2)
+ case (MethodType(_, _), _) => false
+ case (PolyType(_, _), _) => false
+ case (_, MethodType(_, _)) => false
+ case (_, PolyType(_, _)) => false
case _ =>
!phase.erasedTypes || tp1 =:= tp2
}
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index e36c40cfc0..40012423a9 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))
@@ -217,9 +217,9 @@ abstract class ClassfileParser {
f
}
- def getNameAndType(index: Int, ownerTpe: Type): Pair[Name, Type] = {
+ def getNameAndType(index: Int, ownerTpe: Type): (Name, Type) = {
if (index <= 0 || len <= index) errorBadIndex(index)
- var p = values(index).asInstanceOf[Pair[Name, Type]]
+ var p = values(index).asInstanceOf[(Name, Type)]
if (p eq null) {
val start = starts(index)
if (in.buf(start) != CONSTANT_NAMEANDTYPE) errorBadTag(start)
@@ -232,7 +232,7 @@ abstract class ClassfileParser {
tpe = MethodType(formals, ownerTpe)
}
- p = Pair(name, tpe)
+ p = (name, tpe)
}
p
}
@@ -697,10 +697,10 @@ abstract class ClassfileParser {
val attrNameIndex = in.nextChar
val attrType = pool.getType(attrNameIndex)
val nargs = in.nextChar
- val nvpairs = new ListBuffer[Pair[Name,Constant]]
+ val nvpairs = new ListBuffer[(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/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
index 2dcd983b0c..5b521f12c8 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
@@ -40,7 +40,7 @@ abstract class ICodeReader extends ClassfileParser {
* two IClass objects, one for static members and one
* for non-static members.
*/
- def readClass(cls: Symbol): Pair[IClass, IClass] = {
+ def readClass(cls: Symbol): (IClass, IClass) = {
var classFile: AbstractFile = null;
var sym = cls
isScalaModule = cls.isModule && !cls.hasFlag(JAVA)
@@ -56,7 +56,7 @@ abstract class ICodeReader extends ClassfileParser {
this.staticCode = new IClass(sym.linkedClassOfClass)
parse(classFile, sym)
- Pair(staticCode, instanceCode)
+ (staticCode, instanceCode)
}
/** If we're parsing a scala module, the owner of members is always
@@ -86,12 +86,12 @@ abstract class ICodeReader extends ClassfileParser {
}
override def parseField(): Unit = {
- val Pair(jflags, sym) = parseMember()
+ val (jflags, sym) = parseMember()
getCode(jflags).addField(new IField(sym))
skipAttributes()
}
- private def parseMember(): Pair[Int, Symbol] = {
+ private def parseMember(): (Int, Symbol) = {
val jflags = in.nextChar
val name = pool.getName(in.nextChar)
var tpe = pool.getType(in.nextChar)
@@ -103,19 +103,19 @@ abstract class ICodeReader extends ClassfileParser {
}
if ("<clinit>" == name.toString)
- Pair(jflags, NoSymbol)
+ (jflags, NoSymbol)
else {
var sym = getOwner(jflags).info.member(name).suchThat(old => old.tpe =:= tpe);
if (sym == NoSymbol)
sym = getOwner(jflags).info.member(newTermName(name.toString + nme.LOCAL_SUFFIX)).suchThat(old => old.tpe =:= tpe);
if (sym == NoSymbol)
Console.println("Could not find symbol for " + name + ": " + tpe);
- Pair(jflags, sym)
+ (jflags, sym)
}
}
override def parseMethod(): Unit = {
- val Pair(jflags, sym) = parseMember();
+ val (jflags, sym) = parseMember();
if (sym != NoSymbol) {
Console.println("Parsing method " + sym.fullNameString);
this.method = new IMethod(sym);
@@ -568,15 +568,15 @@ abstract class ICodeReader extends ClassfileParser {
if ((flags & JAVA_ACC_STATIC) != 0) staticCode else instanceCode
class LinearCode {
- var instrs: ListBuffer[Pair[Int, Instruction]] = new ListBuffer
+ var instrs: ListBuffer[(Int, Instruction)] = new ListBuffer
var jmpTargets: Set[Int] = new HashSet[Int]
- var locals: Map[Int, List[Pair[Local, TypeKind]]] = new HashMap()
+ var locals: Map[Int, List[(Local, TypeKind)]] = new HashMap()
var containsDUPX = false
def emit(i: Instruction) = {
// Console.println(i);
- instrs += Pair(pc, i)
+ instrs += (pc, i)
if (i.isInstanceOf[DupX])
containsDUPX = true
}
@@ -601,7 +601,7 @@ abstract class ICodeReader extends ClassfileParser {
var otherBlock: BasicBlock = null
var disableJmpTarget = false
- for (val Pair(pc, instr) <- instrs.elements) {
+ for (val (pc, instr) <- instrs.elements) {
// Console.println("> " + pc + ": " + instr);
if (jmpTargets contains pc) {
otherBlock = blocks(pc)
@@ -652,21 +652,21 @@ abstract class ICodeReader extends ClassfileParser {
import analysis._
/** Abstract interpretation for one instruction. */
override def interpret(in: typeFlowLattice.Elem, i: Instruction): typeFlowLattice.Elem = {
- var out = Pair(new VarBinding(in._1), new TypeStack(in._2));
+ var out = (new VarBinding(in._1), new TypeStack(in._2));
val bindings = out._1;
val stack = out._2;
import stack.push
i match {
case DUP_X1 =>
- val Pair(one, two) = stack.pop2
+ val (one, two) = stack.pop2
push(one); push(two); push(one);
case DUP_X2 =>
- val Triple(one, two, three) = stack.pop3
+ val (one, two, three) = stack.pop3
push(one); push(three); push(two); push(one);
case DUP2_X1 =>
- val Pair(one, two) = stack.pop2
+ val (one, two) = stack.pop2
if (one.isWideType) {
push(one); push(two); push(one);
} else {
@@ -675,7 +675,7 @@ abstract class ICodeReader extends ClassfileParser {
}
case DUP2_X2 =>
- val Pair(one, two) = stack.pop2
+ val (one, two) = stack.pop2
if (one.isWideType && two.isWideType) {
push(one); push(two); push(one);
} else if (one.isWideType) {
@@ -842,10 +842,10 @@ abstract class ICodeReader extends ClassfileParser {
case Some(ls) =>
val l = ls find { loc => loc._2 == kind }
l match {
- case Some(Pair(loc, _)) => loc
+ case Some((loc, _)) => loc
case None =>
val l = freshLocal(kind)
- locals(idx) = Pair(l, kind) :: locals(idx)
+ locals(idx) = (l, kind) :: locals(idx)
log("Expected kind " + kind + " for local " + idx +
" but only " + ls + " found. Added new local.")
l
@@ -853,7 +853,7 @@ abstract class ICodeReader extends ClassfileParser {
case None =>
checkValidIndex
val l = freshLocal(idx, kind, false)
- locals += idx -> List(Pair(l, kind))
+ locals += idx -> List((l, kind))
l
}
}
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
index f1ed8f36c0..5dc137e102 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/Pickler.scala
@@ -169,15 +169,15 @@ abstract class Pickler extends SubComponent {
}
private def putChildren(sym: Symbol, children: List[Symbol]): unit = {
- assert(putEntry(Pair(sym, children)))
+ assert(putEntry((sym, children)))
children foreach putSymbol
}
private def putAnnotation(sym: Symbol, attr: AttrInfo): unit = {
- assert(putEntry(Pair(sym, attr)))
+ assert(putEntry((sym, attr)))
putType(attr.atp)
for (val c <- attr.args) putConstant(c)
- for (val Pair(name, c) <- attr.assocs) { putEntry(name); putConstant(c) }
+ for (val (name, c) <- attr.assocs) { putEntry(name); putConstant(c) }
}
// Phase 2 methods: Write all entries to byte array ------------------------------
@@ -279,13 +279,13 @@ abstract class Pickler extends SubComponent {
LITERAL + c.tag
case AttributedType(attribs, tp) =>
writeBody(tp) // obviously, this should be improved
- case Pair(target: Symbol, attr @ AttrInfo(atp, args, assocs)) =>
+ case (target: Symbol, attr @ AttrInfo(atp, args, assocs)) =>
writeRef(target)
writeRef(atp)
for (val c <- args) writeRef(c)
- for (val Pair(name, c) <- assocs) { writeRef(name); writeRef(c) }
+ for (val (name, c) <- assocs) { writeRef(name); writeRef(c) }
ATTRIBUTE
- case Pair(target: Symbol, children: List[_]) =>
+ case (target: Symbol, children: List[_]) =>
writeRef(target)
for (val c <- children) writeRef(c.asInstanceOf[Symbol])
CHILDREN
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
index ac1d10e9be..a338824c8b 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
@@ -288,10 +288,10 @@ abstract class UnPickler {
if (tag == ATTRIBUTE) {
val attrType = readTypeRef()
val args = new ListBuffer[Constant]
- val assocs = new ListBuffer[Pair[Name, Constant]]
+ val assocs = new ListBuffer[(Name, Constant)]
while (readIndex != end) {
val argref = readNat()
- if (isNameEntry(argref)) assocs += Pair(at(argref, readName), readConstantRef())
+ if (isNameEntry(argref)) assocs += (at(argref, readName), readConstantRef())
else args += at(argref, readConstant)
}
val attr = AttrInfo(attrType, args.toList, assocs.toList)
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index 4c80a56704..6d6dca90a3 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -164,16 +164,6 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
}
}
- private def evalOnce(expr: Tree, owner: Symbol, unit: CompilationUnit)
- (within: (() => Tree) => Tree): Tree =
- if (treeInfo.isPureExpr(expr)) {
- within(() => expr);
- } else {
- val temp = owner.newValue(expr.pos, unit.fresh.newName())
- .setFlag(SYNTHETIC).setInfo(expr.tpe);
- Block(List(ValDef(temp, expr)), within(() => Ident(temp) setType expr.tpe))
- }
-
// -------- boxing/unboxing --------------------------------------------------------
override def newTyper(context: Context) = new Eraser(context)
@@ -258,7 +248,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
if (pt.symbol == ArrayClass)
typed {
atPos(tree.pos) {
- evalOnce(tree, context.owner, context.unit) { x =>
+ gen.evalOnce(tree, context.owner, context.unit) { x =>
gen.mkAttributedCast(
If(
Apply(
@@ -275,7 +265,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
else if (pt.symbol isNonBottomSubClass BoxedArrayClass)
typed {
atPos(tree.pos) {
- evalOnce(tree, context.owner, context.unit) { x =>
+ gen.evalOnce(tree, context.owner, context.unit) { x =>
gen.mkAttributedCast(
If(
Apply(
@@ -292,7 +282,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
else if ((SeqClass isNonBottomSubClass pt.symbol) && pt.symbol != ObjectClass)
typed {
atPos(tree.pos) {
- evalOnce(tree, context.owner, context.unit) { x =>
+ gen.evalOnce(tree, context.owner, context.unit) { x =>
gen.mkAttributedCast(
If(
Apply(
@@ -760,7 +750,7 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
Apply(Select(qual, cmpOp), List(gen.mkAttributedQualifier(targ.tpe)))
}
case RefinedType(parents, decls) if (parents.length >= 2) =>
- evalOnce(qual, currentOwner, unit) {
+ gen.evalOnce(qual, currentOwner, unit) {
q =>
def mkIsInstanceOf(tp: Type) =
copy.Apply(tree,
diff --git a/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala b/src/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala
index 68dd7368a9..489808c492 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.UNARY_!, BooleanTag) => Constant(!x.booleanValue)
+ private def foldUnop(op: Name, x: Constant): Constant = (op, x.tag) match {
+ case (nme.UNARY_!, BooleanTag) => Constant(!x.booleanValue)
- case Pair(nme.UNARY_~ , IntTag ) => Constant(~x.intValue)
- case Pair(nme.UNARY_~ , LongTag ) => Constant(~x.longValue)
+ case (nme.UNARY_~ , IntTag ) => Constant(~x.intValue)
+ case (nme.UNARY_~ , LongTag ) => Constant(~x.longValue)
- case Pair(nme.UNARY_+ , IntTag ) => Constant(+x.intValue)
- case Pair(nme.UNARY_+ , LongTag ) => Constant(+x.longValue)
- case Pair(nme.UNARY_+ , FloatTag ) => Constant(+x.floatValue)
- case Pair(nme.UNARY_+ , DoubleTag ) => Constant(+x.doubleValue)
+ case (nme.UNARY_+ , IntTag ) => Constant(+x.intValue)
+ case (nme.UNARY_+ , LongTag ) => Constant(+x.longValue)
+ case (nme.UNARY_+ , FloatTag ) => Constant(+x.floatValue)
+ case (nme.UNARY_+ , DoubleTag ) => Constant(+x.doubleValue)
- case Pair(nme.UNARY_- , IntTag ) => Constant(-x.intValue)
- case Pair(nme.UNARY_- , LongTag ) => Constant(-x.longValue)
- case Pair(nme.UNARY_- , FloatTag ) => Constant(-x.floatValue)
- case Pair(nme.UNARY_- , DoubleTag ) => Constant(-x.doubleValue)
+ case (nme.UNARY_- , IntTag ) => Constant(-x.intValue)
+ case (nme.UNARY_- , LongTag ) => Constant(-x.longValue)
+ case (nme.UNARY_- , FloatTag ) => Constant(-x.floatValue)
+ case (nme.UNARY_- , 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..34bafa6705 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
@@ -95,7 +95,7 @@ trait Contexts requires Analyzer {
var checking = false
var retyping = false
- var savedTypeBounds: List[Pair[Symbol, Type]] = List()
+ var savedTypeBounds: List[(Symbol, Type)] = List()
override def equals(that : Any) = that match {
case that if (super.equals(that)) => true
@@ -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) =>
@@ -391,10 +391,10 @@ trait Contexts requires Analyzer {
private def collectImplicitImports(imp: ImportInfo): List[ImplicitInfo] = {
val pre = imp.qual.tpe
- def collect(sels: List[Pair[Name, Name]]): List[ImplicitInfo] = sels match {
+ def collect(sels: List[(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 fe0ffa65f8..85186da712 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala
@@ -142,7 +142,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) ||
@@ -178,7 +178,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
}
@@ -303,13 +303,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
}
@@ -693,8 +693,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) {
@@ -781,9 +781,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 949740adde..6a877e9f50 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] =
@@ -648,8 +648,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);
@@ -747,8 +747,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 7a06d45cb5..5d377b5a12 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
@@ -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)
diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
index 51ed171076..61bd300472 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 bd534813c2..9c4dca6e59 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 46f3573edb..d6e833b916 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -275,7 +275,7 @@ trait Typers requires Analyzer {
def checkParamsConvertible(pos: PositionType, tpe: Type): unit = tpe match {
case MethodType(formals, restpe) =>
if (formals.exists(.symbol.==(ByNameParamClass)) && formals.length != 1)
- error(pos, "methods with `=>'-parameter can be converted to function values only if they are unary")
+ error(pos, "methods with `=>'-parameter can be converted to function values only if they take no other parameters")
if (formals exists (.symbol.==(RepeatedParamClass)))
error(pos, "methods with `*'-parameters cannot be converted to function values");
checkParamsConvertible(pos, restpe)
@@ -464,7 +464,7 @@ trait Typers requires Analyzer {
else tree
}
- /** The member with givne name of given qualifier tree */
+ /** The member with given name of given qualifier tree */
def member(qual: Tree, name: Name) = qual.tpe match {
case ThisType(clazz) if (context.enclClass.owner.ownerChain contains clazz) =>
qual.tpe.member(name)
@@ -473,6 +473,22 @@ trait Typers requires Analyzer {
else qual.tpe.nonLocalMember(name)
}
+ def silent(op: Typer => Tree): AnyRef /* in fact, TypeError or Tree */ = try {
+ if (context.reportGeneralErrors) {
+ val context1 = context.makeSilent(context.reportAmbiguousErrors)
+ context1.undetparams = context.undetparams
+ val typer1 = newTyper(context1)
+ val result = op(typer1)
+ context.undetparams = context1.undetparams
+ result
+ } else {
+ op(this)
+ }
+ } catch {
+ case ex: CyclicReference => throw ex
+ case ex: TypeError => ex
+ }
+
/** Perform the following adaptations of expression, pattern or type `tree' wrt to
* given mode `mode' and given prototype `pt':
* (0) Convert expressions with constant types to literals
@@ -979,21 +995,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
@@ -1226,16 +1242,16 @@ trait Typers requires Analyzer {
def typedFunction(fun: Function, mode: int, pt: Type): Tree = {
val codeExpected = !forCLDC && !forMSIL && (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)
@@ -1388,11 +1404,9 @@ trait Typers requires Analyzer {
val formals = formalTypes(formals0, args.length)
var args1 = actualArgs(tree.pos, args, formals.length)
if (args1.length != args.length) {
- try {
- silentTypedApply(tree, fun, args1, mode, pt)
- } catch {
- case ex: TypeError =>
- errorTree(tree, "wrong number of arguments for "+treeSymTypeMsg(fun))
+ silent(.typedApply(tree, fun, args1, mode, pt)) match {
+ case t: Tree => t
+ case ex => errorTree(tree, "wrong number of arguments for "+treeSymTypeMsg(fun))
}
} else if (formals.length != args1.length) {
errorTree(tree, "wrong number of arguments for "+treeSymTypeMsg(fun))
@@ -1511,14 +1525,14 @@ trait Typers requires Analyzer {
val oldArgType = arg.tpe
if (!isApplicable(List(), unappType, List(arg.tpe), WildcardType)) {
//Console.println("UNAPP: need to typetest, arg.tpe = "+arg.tpe+", unappType = "+unappType)
- def freshArgType(tp: Type): Pair[Type, List[Symbol]] = tp match {
+ def freshArgType(tp: Type): (Type, List[Symbol]) = tp match {
case MethodType(formals, restpe) =>
- Pair(formals(0), List())
+ (formals(0), List())
case PolyType(tparams, restype) =>
val tparams1 = cloneSymbols(tparams)
- Pair(freshArgType(restype)._1.substSym(tparams, tparams1), tparams1)
+ (freshArgType(restype)._1.substSym(tparams, tparams1), tparams1)
}
- val Pair(unappFormal, freeVars) = freshArgType(unappType)
+ val (unappFormal, freeVars) = freshArgType(unappType)
val context1 = context.makeNewScope(context.tree, context.owner)
freeVars foreach context1.scope.enter
val typer1 = new Typer(context1)
@@ -1548,18 +1562,6 @@ trait Typers requires Analyzer {
}
}
- def silentTypedApply(tree: Tree, fun: Tree, args: List[Tree], mode: int, pt: Type): Tree =
- if (context.reportGeneralErrors) {
- val context1 = context.makeSilent(context.reportAmbiguousErrors)
- context1.undetparams = context.undetparams
- val typer1 = newTyper(context1)
- val result = typer1.typedApply(tree, fun, args, mode, pt)
- context.undetparams = context1.undetparams
- result
- } else {
- typedApply(tree, fun, args, mode, pt)
- }
-
def typedAnnotation(constr: Tree, elements: List[Tree]): AttrInfo = {
var attrError: Boolean = false;
def error(pos: PositionType, msg: String): Null = {
@@ -1591,12 +1593,12 @@ trait Typers requires Analyzer {
error(ntree.pos, "duplicate value for element " + name)
} else {
names -= sym
- Pair(sym.name, getConstant(typed(rhs, EXPRmode | CONSTmode, sym.tpe.resultType)))
+ (sym.name, getConstant(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(constr.pos, "attribute " + tpt.tpe.symbol.fullNameString + " is missing element " + name.name)
}
}
@@ -1651,10 +1653,8 @@ trait Typers requires Analyzer {
try {
newTyper(c).typedArgs(args, mode)
} catch {
- case ex: TypeError =>
- null
- case t : Throwable =>
- throw t
+ case ex: TypeError =>
+ null
}
}
@@ -1665,58 +1665,70 @@ trait Typers requires Analyzer {
* @param args ...
* @return ...
*/
- def tryTypedApply(fun: Tree, args: List[Tree]): Tree = try {
- silentTypedApply(tree, fun, args, mode, pt)
- } catch {
- case ex: CyclicReference =>
- throw ex
- case ex: TypeError =>
- val Select(qual, name) = fun
- val args1 = tryTypedArgs(args, ex)
- val qual1 =
- if ((args1 ne null) && !pt.isError) {
- def templateArgType(arg: Tree) =
- new BoundedWildcardType(mkTypeBounds(arg.tpe, AnyClass.tpe))
- adaptToMember(qual, name, MethodType(args1 map templateArgType, pt))
- } else qual
- if (qual1 ne qual) {
- val tree1 = Apply(Select(qual1, name) setPos fun.pos, args1) setPos tree.pos
- typed1(tree1, mode | SNDTRYmode, pt)
- } else {
- reportTypeError(tree.pos, ex)
- setError(tree)
- }
- case t => throw t;
- }
-/*
- /** Try to apply function to arguments; if it does not work try to insert an implicit
- * conversion
- */
- def tryTypedApply(fun: Tree, args: List[Tree]): Tree = {
- val reportGeneralErrors = context.reportGeneralErrors
- val undetparams = context.undetparams
- try {
- context.reportGeneralErrors = false
- typedApply(tree, fun, args, mode, pt)
- } catch {
- case ex: CyclicReference =>
- throw ex
+ def tryTypedApply(fun: Tree, args: List[Tree]): Tree =
+ silent(.typedApply(tree, fun, args, mode, pt)) match {
+ case t: Tree =>
+ t
case ex: TypeError =>
val Select(qual, name) = fun
- context.undetparams = undetparams
- val args1 = tryTypedArgs(args map (arg => UnTyper.apply(arg)))
- context.reportGeneralErrors = reportGeneralErrors
- def templateArgType(arg: Tree) =
- new BoundedWildcardType(TypeBounds(arg.tpe, AnyClass.tpe))
- val qual1 = if ((args1 eq null) || pt.isError) qual
- else adaptToMember(qual, name, MethodType(args1 map templateArgType, pt))
- val tree1 = Apply(Select(qual1, name) setPos fun.pos, args map (arg => UnTyper.apply(arg))) setPos tree.pos
- typed1(tree1, mode | SNDTRYmode, pt)
- } finally {
- context.reportGeneralErrors = reportGeneralErrors
+ val args1 = tryTypedArgs(args, ex)
+ val qual1 =
+ if ((args1 ne null) && !pt.isError) {
+ def templateArgType(arg: Tree) =
+ new BoundedWildcardType(mkTypeBounds(arg.tpe, AnyClass.tpe))
+ adaptToMember(qual, name, MethodType(args1 map templateArgType, pt))
+ } else qual
+ if (qual1 ne qual) {
+ val tree1 = Apply(Select(qual1, name) setPos fun.pos, args1) setPos tree.pos
+ typed1(tree1, mode | SNDTRYmode, pt)
+ } else {
+ reportTypeError(tree.pos, ex)
+ setError(tree)
+ }
+ }
+
+ def convertToAssignment(fun: Tree, qual: Tree, name: Name, args: List[Tree], ex: TypeError): Tree = {
+ val prefix = name.subName(0, name.length - nme.EQL.length)
+ def mkAssign(vble: Tree): Tree =
+ Assign(
+ vble,
+ Apply(Select(vble.duplicate, prefix) setPos fun.pos, args) setPos tree.pos
+ ) setPos tree.pos
+ val tree1 = qual match {
+ case Select(qualqual, vname) =>
+ gen.evalOnce(qualqual, context.owner, context.unit) { qq =>
+ mkAssign(Select(qq(), vname) setPos qual.pos)
+ }
+ case Apply(Select(table, nme.apply), indices) =>
+ gen.evalOnceAll(table :: indices, context.owner, context.unit) { ts =>
+ val tab = ts.head
+ val is = ts.tail
+ Apply(
+ Select(tab(), nme.update) setPos table.pos,
+ ((is map (i => i())) ::: List(
+ Apply(
+ Select(
+ Apply(
+ Select(tab(), nme.apply) setPos table.pos,
+ is map (i => i())) setPos qual.pos,
+ prefix) setPos fun.pos,
+ args) setPos tree.pos)
+ )
+ ) setPos tree.pos
+ }
+ case Ident(_) =>
+ mkAssign(qual)
+ }
+ if (settings.debug.value) log("retry assign: "+tree1)
+ silent(.typed1(tree1, mode, pt)) match {
+ case t: Tree =>
+ t
+ case _ =>
+ reportTypeError(tree.pos, ex)
+ setError(tree)
}
}
-*/
+
/** Attribute a selection where <code>tree</code> is <code>qual.name</code>.
* <code>qual</code> is already attributed.
*
@@ -2198,29 +2210,44 @@ trait Typers requires Analyzer {
typed1(tree, mode & ~PATTERNmode | EXPRmode, pt)
} else {
val funpt = if ((mode & PATTERNmode) != 0) pt else WildcardType
- var fun1 = typed(fun, funMode(mode), funpt)
- if (stableApplication) fun1 = stabilizeFun(fun1, mode, pt)
- // if function is overloaded, filter all alternatives that match
- // number of arguments and expected result type.
- if (util.Statistics.enabled) appcnt = appcnt + 1
- val ret = if (phase.id <= currentRun.typerPhase.id &&
- fun1.isInstanceOf[Select] &&
- !fun1.tpe.isInstanceOf[ImplicitMethodType] &&
- ((fun1.symbol eq null) || !fun1.symbol.isConstructor) &&
- (mode & (EXPRmode | SNDTRYmode)) == EXPRmode) tryTypedApply(fun1, args)
- else {
- typedApply(tree, fun1, args, mode, pt)
+ silent(.typed(fun, funMode(mode), funpt)) match {
+ case fun1: Tree =>
+ val fun2 = if (stableApplication) stabilizeFun(fun1, mode, pt) else fun1
+ if (util.Statistics.enabled) appcnt = appcnt + 1
+ if (phase.id <= currentRun.typerPhase.id &&
+ fun2.isInstanceOf[Select] &&
+ !fun2.tpe.isInstanceOf[ImplicitMethodType] &&
+ ((fun2.symbol eq null) || !fun2.symbol.isConstructor) &&
+ (mode & (EXPRmode | SNDTRYmode)) == EXPRmode) tryTypedApply(fun2, args)
+ else {
+ typedApply(tree, fun2, args, mode, pt)
+ }
+ case ex: TypeError =>
+ fun match {
+ case Select(qual, name) =>
+ val qual1 = typedQualifier(qual)
+ if ((mode & PATTERNmode) == 0 &&
+ nme.isOpAssignmentName(name) &&
+ treeInfo.isVariableOrGetter(qual1)) {
+ convertToAssignment(fun, qual1, name, args, ex)
+ } else {
+ reportTypeError(fun.pos, ex)
+ setError(tree)
+ }
+ case _ =>
+ reportTypeError(fun.pos, ex)
+ setError(tree)
+ }
}
- ret
}
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 {
@@ -2246,12 +2273,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 {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Variances.scala b/src/compiler/scala/tools/nsc/typechecker/Variances.scala
index 43e394cd91..1e112d320f 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Variances.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Variances.scala
@@ -53,7 +53,7 @@ trait Variances {
* `tps' which correspond to formal type parameters `tparams1'. */
def varianceInArgs(tps: List[Type], tparams1: List[Symbol])(tparam: Symbol): int = {
var v: int = VARIANCES;
- for (val Pair(tp, tparam1) <- tps zip tparams1) {
+ for (val (tp, tparam1) <- tps zip tparams1) {
val v1 = varianceInType(tp)(tparam);
v = v & (if (tparam1.isCovariant) v1
else if (tparam1.isContravariant) flip(v1)