summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/Course-2002-05.scala16
-rw-r--r--test/files/run/Course-2002-06.scala2
-rw-r--r--test/files/run/Course-2002-07.scala140
-rw-r--r--test/files/run/Course-2002-08.scala28
-rw-r--r--test/files/run/Course-2002-09.scala40
-rw-r--r--test/files/run/Course-2002-13.scala16
-rw-r--r--test/files/run/bugs.scala2
-rw-r--r--test/files/run/ctries-old/main.scala2
-rw-r--r--test/files/run/getClassTest-old.scala2
-rw-r--r--test/files/run/map_test.scala2
-rw-r--r--test/files/run/patmatnew.scala28
-rw-r--r--test/files/run/t3888.scala2
-rw-r--r--test/files/run/t6329_repl_bug.check17
-rw-r--r--test/files/run/t6329_repl_bug.scala (renamed from test/files/run/t6329_repl_bug.pending)0
-rw-r--r--test/files/run/t6329_vanilla_bug.check3
-rw-r--r--test/files/run/t6329_vanilla_bug.scala (renamed from test/files/run/t6329_vanilla_bug.pending)0
-rw-r--r--test/files/run/t7985.scala3
-rw-r--r--test/files/run/t7985b.scala5
-rw-r--r--test/files/run/tailcalls.scala2
-rw-r--r--test/files/run/tcpoly_parseridioms.check4
-rw-r--r--test/files/run/tcpoly_parseridioms.scala8
-rw-r--r--test/files/run/withIndex.scala2
22 files changed, 176 insertions, 148 deletions
diff --git a/test/files/run/Course-2002-05.scala b/test/files/run/Course-2002-05.scala
index e6764b92c8..80317bc757 100644
--- a/test/files/run/Course-2002-05.scala
+++ b/test/files/run/Course-2002-05.scala
@@ -3,15 +3,15 @@
//############################################################################
object M0 {
- def partition[a](xs: List[a], pred: a => Boolean): Pair[List[a], List[a]] = {
+ def partition[a](xs: List[a], pred: a => Boolean): Tuple2[List[a], List[a]] = {
if (xs.isEmpty)
- Pair(List(),List())
+ (List(),List())
else {
val tailPartition = partition(xs.tail, pred);
if (pred(xs.head))
- Pair(xs.head :: tailPartition._1, tailPartition._2)
+ (xs.head :: tailPartition._1, tailPartition._2)
else
- Pair(tailPartition._1, xs.head :: tailPartition._2)
+ (tailPartition._1, xs.head :: tailPartition._2)
}
}
@@ -49,9 +49,9 @@ object M0 {
//############################################################################
object M1 {
- def partition[a](xs: List[a], pred: a => Boolean): Pair[List[a], List[a]] = {
- xs.foldRight[Pair[List[a], List[a]]](Pair(List(), List())) {
- (x, p) => if (pred (x)) Pair(x :: p._1, p._2) else Pair(p._1, x :: p._2)
+ def partition[a](xs: List[a], pred: a => Boolean): Tuple2[List[a], List[a]] = {
+ xs.foldRight[Tuple2[List[a], List[a]]]((List(), List())) {
+ (x, p) => if (pred (x)) (x :: p._1, p._2) else (p._1, x :: p._2)
}
}
@@ -136,7 +136,7 @@ object M3 {
def adjoinRow(placement: Placement): List[Placement] =
range(1, n)
.filter (column => isSafe(column, placement))
- .map (column => Pair(row, column) :: placement);
+ .map (column => (row, column) :: placement);
placeQueens(row - 1) flatMap adjoinRow
}
diff --git a/test/files/run/Course-2002-06.scala b/test/files/run/Course-2002-06.scala
index e4fb86a966..908a934041 100644
--- a/test/files/run/Course-2002-06.scala
+++ b/test/files/run/Course-2002-06.scala
@@ -55,7 +55,7 @@ abstract class Graphics(_width: Double, _height: Double) {
}
/** Draw a list of segments on the picture.*/
- def drawSegments(frm: Frame)(segments: List[Pair[Vector, Vector]]): Unit =
+ def drawSegments(frm: Frame)(segments: List[Tuple2[Vector, Vector]]): Unit =
if (segments.isEmpty) ()
else {
drawSegment(frm)(segments.head._1, segments.head._2);
diff --git a/test/files/run/Course-2002-07.scala b/test/files/run/Course-2002-07.scala
index 055ff74d81..2d9457653f 100644
--- a/test/files/run/Course-2002-07.scala
+++ b/test/files/run/Course-2002-07.scala
@@ -181,10 +181,10 @@ object M4 {
object M5 {
- def zipFun[a,b](xs:List[a], ys:List[b]):List[Pair[a,b]] = Pair(xs,ys) match {
- case Pair(List(), _) => List()
- case Pair(_, List()) => List()
- case Pair(x :: xs1, y :: ys1) => Pair(x, y) :: zipFun(xs1, ys1)
+ def zipFun[a,b](xs:List[a], ys:List[b]):List[Tuple2[a,b]] = (xs,ys) match {
+ case (List(), _) => List()
+ case (_, List()) => List()
+ case (x :: xs1, y :: ys1) => (x, y) :: zipFun(xs1, ys1)
}
def test_zipFun[a,b](xs: List[a], ys: List[b]) = {
@@ -216,9 +216,9 @@ object M5 {
object M6 {
- def zipFun[a,b](xs:List[a], ys:List[b]):List[Pair[a,b]] = (Pair(xs,ys): @unchecked) match {
- // !!! case Pair(List(), _), Pair(_, List()) => List()
- case Pair(x :: xs1, y :: ys1) => Pair(x, y) :: zipFun(xs1, ys1)
+ def zipFun[a,b](xs:List[a], ys:List[b]):List[Tuple2[a,b]] = ((xs,ys): @unchecked) match {
+ // !!! case (List(), _), (_, List()) => List()
+ case (x :: xs1, y :: ys1) => (x, y) :: zipFun(xs1, ys1)
}
def test_zipFun[a,b](xs: List[a], ys: List[b]) = {
@@ -374,9 +374,9 @@ object M9 {
object MA {
- def lookup[k,v](xs: List[Pair[k,v]], k: k): v = xs match {
+ def lookup[k,v](xs: List[Tuple2[k,v]], k: k): v = xs match {
case List() => sys.error("no value for " + k)
- case Pair(k1,v1) :: xs1 => if (k1 == k) v1 else lookup(xs1, k)
+ case (k1,v1) :: xs1 => if (k1 == k) v1 else lookup(xs1, k)
}
trait Expr {
@@ -437,8 +437,8 @@ object MA {
val g1 = g0 derive x;
Console.println("g (x) = " + g0);
Console.println("g'(x) = " + g1);
- Console.println("g (3) = " + evalvars(List(Pair("x",3)))(g0));
- Console.println("g'(3) = " + evalvars(List(Pair("x",3)))(g1));
+ Console.println("g (3) = " + evalvars(List(("x",3)))(g0));
+ Console.println("g'(3) = " + evalvars(List(("x",3)))(g1));
Console.println;
}
@@ -453,26 +453,26 @@ object Utils {
if (y == 1) x else if (y % 2 == 0) power0(x*x,y/2) else x*power0(x, y-1);
def power(x: Int, y: Int): Int = (x,y) match {
- case Pair(0,0) => sys.error("power(0,0)")
- case Pair(0,_) => 0
- case Pair(1,_) => 1
- case Pair(_,0) => 1
- case Pair(_,1) => x
- case Pair(_,2) => x*x
- case Pair(_,_) => if (y < 0) 1/power0(x,y) else power0(x,y)
+ case (0,0) => sys.error("power(0,0)")
+ case (0,_) => 0
+ case (1,_) => 1
+ case (_,0) => 1
+ case (_,1) => x
+ case (_,2) => x*x
+ case (_,_) => if (y < 0) 1/power0(x,y) else power0(x,y)
}
def lookup(entries: List[(String,Int)], key: String): Int = entries match {
case List() => sys.error("no value for " + key)
- case Pair(k,v) :: _ if (k == key) => v
+ case (k,v) :: _ if (k == key) => v
case _ :: rest => lookup(rest, key)
}
def compare(xs: List[String], ys: List[String]): Int = (xs, ys) match {
- case Pair(List(), List()) => 0
- case Pair(List(), _ ) => -1
- case Pair(_ , List()) => +1
- case Pair(x::xs , y::ys ) => {
+ case (List(), List()) => 0
+ case (List(), _ ) => -1
+ case (_ , List()) => +1
+ case (x::xs , y::ys ) => {
val diff = x.compareTo(y);
if (diff != 0) diff else compare(xs,ys)
}
@@ -508,18 +508,18 @@ object MB {
private def +< (that: Expr): Boolean = (this +<? that) < 0;
private def +<= (that: Expr): Boolean = (this +<? that) <= 0;
- private def +<? (that: Expr): Int = Pair(this,that) match {
- case Pair(Add(_,_), _ ) => 0
- case Pair(_ , Add(_,_)) => 0
- case Pair(_ , _ ) => compare(this.vars,that.vars)
+ private def +<? (that: Expr): Int = (this,that) match {
+ case (Add(_,_), _ ) => 0
+ case (_ , Add(_,_)) => 0
+ case (_ , _ ) => compare(this.vars,that.vars)
}
- def + (that: Expr): Expr = if (that +<= this) Pair(this,that) match {
- case Pair(_ , Lit(0) ) => this
- case Pair(Lit(l) , Lit(r) ) => Lit(l + r)
- case Pair(_ , Add(rl,rr)) => (this + rl) + rr
- case Pair(Add(ll,lr), _ ) if (lr +<= that) => ll + (that + lr)
- case Pair(_ , _ ) => {
+ def + (that: Expr): Expr = if (that +<= this) (this,that) match {
+ case (_ , Lit(0) ) => this
+ case (Lit(l) , Lit(r) ) => Lit(l + r)
+ case (_ , Add(rl,rr)) => (this + rl) + rr
+ case (Add(ll,lr), _ ) if (lr +<= that) => ll + (that + lr)
+ case (_ , _ ) => {
val l = this.term;
val r = that.term;
if (l equ r) Lit(this.count + that.count) * r else Add(this, that)
@@ -528,41 +528,41 @@ object MB {
private def *< (that: Expr): Boolean = (this *<? that) < 0;
private def *<= (that: Expr): Boolean = (this *<? that) <= 0;
- private def *<? (that: Expr): Int = Pair(this,that) match {
- case Pair(Mul(_,_), _ ) => 0
- case Pair(_ , Mul(_,_)) => 0
- case Pair(Add(_,_), Add(_,_)) => 0
- case Pair(Add(_,_), _ ) => -1
- case Pair(_ , Add(_,_)) => +1
- case Pair(Lit(_) , Lit(_) ) => 0
- case Pair(Lit(_) , _ ) => -1
- case Pair(_ , Lit(_) ) => +1
- case Pair(Var(l) , Var(r) ) => l.compareTo(r)
- case Pair(Var(_) , Pow(r,_)) => if (this *<= r) -1 else +1
- case Pair(Pow(l,_), Var(_) ) => if (l *< that) -1 else +1
- case Pair(Pow(l,_), Pow(r,_)) => l *<? r
+ private def *<? (that: Expr): Int = (this,that) match {
+ case (Mul(_,_), _ ) => 0
+ case (_ , Mul(_,_)) => 0
+ case (Add(_,_), Add(_,_)) => 0
+ case (Add(_,_), _ ) => -1
+ case (_ , Add(_,_)) => +1
+ case (Lit(_) , Lit(_) ) => 0
+ case (Lit(_) , _ ) => -1
+ case (_ , Lit(_) ) => +1
+ case (Var(l) , Var(r) ) => l.compareTo(r)
+ case (Var(_) , Pow(r,_)) => if (this *<= r) -1 else +1
+ case (Pow(l,_), Var(_) ) => if (l *< that) -1 else +1
+ case (Pow(l,_), Pow(r,_)) => l *<? r
}
- def * (that: Expr): Expr = if (this *<= that) Pair(this,that) match {
- case Pair(Lit(0) , _ ) => this
- case Pair(Lit(1) , _ ) => that
- case Pair(Mul(ll,lr), r ) => ll * (lr * r)
- case Pair(Add(ll,lr), r ) => ll * r + lr * r
- case Pair(Lit(l) , Lit(r) ) => Lit(l * r)
- case Pair(Var(_) , Var(_) ) if (this equ that) => Pow(this,2)
- case Pair(Var(_) , Pow(r,n) ) if (this equ r) => Pow(this,n + 1)
- case Pair(Pow(ll,lr), Pow(rl,rr)) if (ll equ rl) => Pow(ll,lr + rr)
- case Pair(l , Mul(rl,rr)) if (rl *<= l) => (rl * l) * rr
- case Pair(_ , _ ) => Mul(this,that)
+ def * (that: Expr): Expr = if (this *<= that) (this,that) match {
+ case (Lit(0) , _ ) => this
+ case (Lit(1) , _ ) => that
+ case (Mul(ll,lr), r ) => ll * (lr * r)
+ case (Add(ll,lr), r ) => ll * r + lr * r
+ case (Lit(l) , Lit(r) ) => Lit(l * r)
+ case (Var(_) , Var(_) ) if (this equ that) => Pow(this,2)
+ case (Var(_) , Pow(r,n) ) if (this equ r) => Pow(this,n + 1)
+ case (Pow(ll,lr), Pow(rl,rr)) if (ll equ rl) => Pow(ll,lr + rr)
+ case (l , Mul(rl,rr)) if (rl *<= l) => (rl * l) * rr
+ case (_ , _ ) => Mul(this,that)
} else that * this;
def ^ (that: Int): Expr = (this,that) match {
- case Pair(_ ,1) => this
- case Pair(Lit(i) ,n) => Lit(power(i,n))
- case Pair(Var(_) ,n) => Pow(this,n)
- case Pair(Add(_,_),n) => this * (this ^ (n - 1))
- case Pair(Mul(l,r),n) => (l ^ n) * (r ^ n)
- case Pair(Pow(e,m),n) => Pow(e,m + n)
+ case (_ ,1) => this
+ case (Lit(i) ,n) => Lit(power(i,n))
+ case (Var(_) ,n) => Pow(this,n)
+ case (Add(_,_),n) => this * (this ^ (n - 1))
+ case (Mul(l,r),n) => (l ^ n) * (r ^ n)
+ case (Pow(e,m),n) => Pow(e,m + n)
}
def derive(v: Var): Expr = this match {
@@ -581,12 +581,12 @@ object MB {
case Pow(l, r) => power(l.evaluate(vars), r)
}
- def equ(that: Expr): Boolean = Pair(this,that) match {
- case Pair(Lit(l) ,Lit(r)) => l == r
- case Pair(Var(l) ,Var(r)) => l == r
- case Pair(Add(ll,lr),Add(rl,rr)) => (ll equ rl) && (lr equ rr)
- case Pair(Mul(ll,lr),Mul(rl,rr)) => (ll equ rl) && (lr equ rr)
- case Pair(Pow(ll,lr),Pow(rl,rr)) => (ll equ rl) && (lr == rr)
+ def equ(that: Expr): Boolean = (this,that) match {
+ case (Lit(l) ,Lit(r)) => l == r
+ case (Var(l) ,Var(r)) => l == r
+ case (Add(ll,lr),Add(rl,rr)) => (ll equ rl) && (lr equ rr)
+ case (Mul(ll,lr),Mul(rl,rr)) => (ll equ rl) && (lr equ rr)
+ case (Pow(ll,lr),Pow(rl,rr)) => (ll equ rl) && (lr == rr)
case _ => false
}
@@ -667,7 +667,7 @@ object MB {
Console.println;
def check(n: String, f: Expr, x: Int, e: Int) {
- val a: Int = f.evaluate(List(Pair("x",x)));
+ val a: Int = f.evaluate(List(("x",x)));
val s: String = if (a == e) "ok" else "KO(" + e + ")";
Console.println(n + "(" + x + ") = " + a + " " + s);
}
diff --git a/test/files/run/Course-2002-08.scala b/test/files/run/Course-2002-08.scala
index 38b8363661..5e21edaba3 100644
--- a/test/files/run/Course-2002-08.scala
+++ b/test/files/run/Course-2002-08.scala
@@ -163,7 +163,7 @@ object M5 {
}
abstract class Simulation() {
- private type Agenda = List[Pair[Int, Action]];
+ private type Agenda = List[Tuple2[Int, Action]];
private var agenda: Agenda = List();
private var curtime = 0;
def currentTime: Int = curtime;
@@ -171,17 +171,17 @@ object M5 {
def afterDelay(delay: Int)(action: Action): Unit = {
def insert(ag: Agenda, time: Int): Agenda = ag match {
case List() =>
- List(Pair(time, action))
- case Pair(t, act) :: ag1 =>
- if (time < t) Pair(time, action) :: ag
- else Pair(t, act) :: insert(ag1, time)
+ List((time, action))
+ case (t, act) :: ag1 =>
+ if (time < t) (time, action) :: ag
+ else (t, act) :: insert(ag1, time)
}
agenda = insert(agenda, curtime + delay)
}
private def next: Unit = agenda match {
case List() => ()
- case Pair(time, action) :: ag1 => {
+ case (time, action) :: ag1 => {
agenda = ag1;
curtime = time;
action();
@@ -413,7 +413,7 @@ object M5 {
class Simulator() {
type Action = () => Unit;
- type Agenda = List[Pair[Int, Action]];
+ type Agenda = List[Tuple2[Int, Action]];
private var agenda: Agenda = List();
private var curtime = 0;
@@ -421,17 +421,17 @@ class Simulator() {
def afterDelay(delay: Int)(action: Action) = {
def insert(ag: Agenda, time: Int): Agenda = ag match {
case List() =>
- List(Pair(time, action))
- case Pair(t, act) :: ag1 =>
- if (time < t) Pair(time, action) :: ag
- else Pair(t, act) :: insert(ag1, time)
+ List((time, action))
+ case (t, act) :: ag1 =>
+ if (time < t) (time, action) :: ag
+ else (t, act) :: insert(ag1, time)
}
agenda = insert(agenda, curtime + delay)
}
def next: Unit = agenda match {
case List() => ()
- case Pair(time, action) :: rest => {
+ case (time, action) :: rest => {
agenda = rest;
curtime = time;
action();
@@ -567,8 +567,8 @@ class Main() extends CircuitSimulator() {
demux(in, ctrl.reverse, out.reverse);
probe("in", in);
- for (Pair(x,c) <- range(0,n) zip ctrl) { probe("ctrl" + x, c) }
- for (Pair(x,o) <- range(0,outNum) zip out) { probe("out" + x, o) }
+ for ((x,c) <- range(0,n) zip ctrl) { probe("ctrl" + x, c) }
+ for ((x,o) <- range(0,outNum) zip out) { probe("out" + x, o) }
in.setSignal(true);
run;
diff --git a/test/files/run/Course-2002-09.scala b/test/files/run/Course-2002-09.scala
index 87f91111d8..704f2ec0aa 100644
--- a/test/files/run/Course-2002-09.scala
+++ b/test/files/run/Course-2002-09.scala
@@ -13,11 +13,11 @@ object NoConstraint extends Constraint {
}
class Adder(a1: Quantity,a2: Quantity,sum: Quantity) extends Constraint {
- def newValue = Triple(a1.getValue, a2.getValue, sum.getValue) match {
- case Triple(Some(x1), Some(x2), _ ) => sum.setValue(x1 + x2, this)
- case Triple(Some(x1), _ , Some(r)) => a2.setValue(r - x1, this)
- case Triple(_ , Some(x2), Some(r)) => a1.setValue(r - x2, this)
- case _ =>
+ def newValue = (a1.getValue, a2.getValue, sum.getValue) match {
+ case (Some(x1), Some(x2), _ ) => sum.setValue(x1 + x2, this)
+ case (Some(x1), _ , Some(r)) => a2.setValue(r - x1, this)
+ case (_ , Some(x2), Some(r)) => a1.setValue(r - x2, this)
+ case _ =>
}
def dropValue: Unit = {
a1.forgetValue(this); a2.forgetValue(this); sum.forgetValue(this);
@@ -29,13 +29,13 @@ class Adder(a1: Quantity,a2: Quantity,sum: Quantity) extends Constraint {
class Multiplier(m1: Quantity, m2: Quantity, prod: Quantity)
extends Constraint {
- def newValue = Triple(m1.getValue, m2.getValue, prod.getValue) match {
- case Triple(Some(0d), _ , _ ) => prod.setValue(0, this);
- case Triple(_ , Some(0d), _ ) => prod.setValue(0, this);
- case Triple(Some(x1), Some(x2), _ ) => prod.setValue(x1 * x2, this)
- case Triple(Some(x1), _ , Some(r)) => m2.setValue(r / x1, this)
- case Triple(_, Some(x2), Some(r)) => m1.setValue(r / x2, this)
- case _ =>
+ def newValue = (m1.getValue, m2.getValue, prod.getValue) match {
+ case (Some(0d), _ , _ ) => prod.setValue(0, this);
+ case (_ , Some(0d), _ ) => prod.setValue(0, this);
+ case (Some(x1), Some(x2), _ ) => prod.setValue(x1 * x2, this)
+ case (Some(x1), _ , Some(r)) => m2.setValue(r / x1, this)
+ case (_, Some(x2), Some(r)) => m1.setValue(r / x2, this)
+ case _ =>
}
def dropValue: Unit = {
m1.forgetValue(this); m2.forgetValue(this); prod.forgetValue(this);
@@ -46,11 +46,11 @@ class Multiplier(m1: Quantity, m2: Quantity, prod: Quantity)
}
class Squarer(square: Quantity, root: Quantity) extends Constraint {
- def newValue: Unit = Pair(square.getValue, root.getValue) match {
- case Pair(Some(x), _ )if (x < 0) => sys.error("Square of negative number")
- case Pair(Some(x), _ ) => root.setValue(Math.sqrt(x), this)
- case Pair(_ , Some(x)) => square.setValue(x*x, this)
- case _ =>
+ def newValue: Unit = (square.getValue, root.getValue) match {
+ case (Some(x), _ )if (x < 0) => sys.error("Square of negative number")
+ case (Some(x), _ ) => root.setValue(Math.sqrt(x), this)
+ case (_ , Some(x)) => square.setValue(x*x, this)
+ case _ =>
}
def dropValue: Unit = {
square.forgetValue(this); root.forgetValue(this);
@@ -60,9 +60,9 @@ class Squarer(square: Quantity, root: Quantity) extends Constraint {
}
class Eq(a: Quantity, b: Quantity) extends Constraint {
- def newValue = (Pair(a.getValue, b.getValue): @unchecked) match {
- case Pair(Some(x), _ ) => b.setValue(x, this);
- case Pair(_ , Some(y)) => a.setValue(y, this);
+ def newValue = ((a.getValue, b.getValue): @unchecked) match {
+ case (Some(x), _ ) => b.setValue(x, this);
+ case (_ , Some(y)) => a.setValue(y, this);
}
def dropValue {
a.forgetValue(this); b.forgetValue(this);
diff --git a/test/files/run/Course-2002-13.scala b/test/files/run/Course-2002-13.scala
index 4bd3614fb0..a596a33873 100644
--- a/test/files/run/Course-2002-13.scala
+++ b/test/files/run/Course-2002-13.scala
@@ -74,18 +74,18 @@ object Terms {
val NoTerm = Con("<none>", List());
- def unify1(x: Term, y: Term, s: Subst): Option[Subst] = Pair(x, y) match {
- case Pair(Var(a), Var(b)) if (a == b) =>
+ def unify1(x: Term, y: Term, s: Subst): Option[Subst] = (x, y) match {
+ case (Var(a), Var(b)) if (a == b) =>
Some(s)
- case Pair(Var(a), _) => lookup(s, a) match {
+ case (Var(a), _) => lookup(s, a) match {
case Some(x1) => unify(x1, y, s)
case None => if (y.tyvars contains a) None else Some(Binding(a, y) :: s)
}
- case Pair(_, Var(b)) => lookup(s, b) match {
+ case (_, Var(b)) => lookup(s, b) match {
case Some(y1) => unify(x, y1, s)
case None => if (x.tyvars contains b) None else Some(Binding(b, x) :: s)
}
- case Pair(Con(a, xs), Con(b, ys)) if (a == b) =>
+ case (Con(a, xs), Con(b, ys)) if (a == b) =>
unify(xs, ys, s)
case _ => None
}
@@ -96,9 +96,9 @@ object Terms {
ss
}
- def unify(xs: List[Term], ys: List[Term], s: Subst): Option[Subst] = Pair(xs, ys) match {
- case Pair(List(), List()) => Some(s)
- case Pair(x :: xs1, y :: ys1) =>
+ def unify(xs: List[Term], ys: List[Term], s: Subst): Option[Subst] = (xs, ys) match {
+ case (List(), List()) => Some(s)
+ case (x :: xs1, y :: ys1) =>
unify(x, y, s) match {
case Some(s1) => unify(xs1, ys1, s1)
case None => None
diff --git a/test/files/run/bugs.scala b/test/files/run/bugs.scala
index ba8449c299..02849b5817 100644
--- a/test/files/run/bugs.scala
+++ b/test/files/run/bugs.scala
@@ -46,7 +46,7 @@ object Bug135Test {
def test(args: Array[String]) {
val myMap:TreeMap[Int, String] = new TreeMap
- val map1 = myMap + Pair(42, "The answer")
+ val map1 = myMap + ((42, "The answer"))
println(map1.get(42))
}
diff --git a/test/files/run/ctries-old/main.scala b/test/files/run/ctries-old/main.scala
index f714bcdcdc..77161fed2f 100644
--- a/test/files/run/ctries-old/main.scala
+++ b/test/files/run/ctries-old/main.scala
@@ -38,7 +38,7 @@ trait Spec {
var produced = false
try body
catch {
- case e: Throwable => if (e.getClass == implicitly[ClassManifest[T]].erasure) produced = true
+ case e: Throwable => if (e.getClass == implicitly[ClassManifest[T]].runtimeClass) produced = true
} finally {
assert(produced, "Did not produce exception of type: " + implicitly[ClassManifest[T]])
}
diff --git a/test/files/run/getClassTest-old.scala b/test/files/run/getClassTest-old.scala
index 789dd4d162..cd1b6b07f6 100644
--- a/test/files/run/getClassTest-old.scala
+++ b/test/files/run/getClassTest-old.scala
@@ -53,7 +53,7 @@ class MoreAnyRefs {
@deprecated("Suppress warnings", since="2.11")
object Test {
def returnTypes[T: Manifest] = (
- manifest[T].erasure.getMethods.toList
+ manifest[T].runtimeClass.getMethods.toList
filter (_.getName startsWith "f")
sortBy (_.getName)
map (m => m.getName + ": " + m.getGenericReturnType.toString)
diff --git a/test/files/run/map_test.scala b/test/files/run/map_test.scala
index 1ea864ed58..b76dfb4577 100644
--- a/test/files/run/map_test.scala
+++ b/test/files/run/map_test.scala
@@ -20,7 +20,7 @@ object Test extends App {
val map2 = map1.updated(17,"A small random number")
val map3 = map2.updated(666,"A bigger random number")
val map4 = map3.updated(4711,"A big random number")
- map1 == myMap + Pair(42, "The answer")
+ map1 == myMap + ((42, "The answer"))
var i = 0
var map = map4
while(i < 43) {
diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala
index b212e10f8d..3c0d00dc6c 100644
--- a/test/files/run/patmatnew.scala
+++ b/test/files/run/patmatnew.scala
@@ -46,7 +46,7 @@ object Test {
object SimpleUnapply {
def run() { // from sortedmap, old version
List((1, 2)).head match {
- case kv@Pair(key, _) => kv.toString + " " + key.toString
+ case kv@(key, _) => kv.toString + " " + key.toString
}
}
@@ -400,9 +400,9 @@ object Test {
// these are exhaustive matches
// should not generate any warnings
def f[A](z: (Option[A], Option[A])) = z match {
- case Pair(None, Some(x)) => 1
- case Pair(Some(x), None) => 2
- case Pair(Some(x), Some(y)) => 3
+ case (None, Some(x)) => 1
+ case (Some(x), None) => 2
+ case (Some(x), Some(y)) => 3
case _ => 4
}
@@ -419,9 +419,9 @@ object Test {
}
def h[A](x: (Option[A], Option[A])) = x match {
- case Pair(None, _: Some[_]) => 1
- case Pair(_: Some[_], None) => 2
- case Pair(_: Some[_], _: Some[_]) => 3
+ case (None, _: Some[_]) => 1
+ case (_: Some[_], None) => 2
+ case (_: Some[_], _: Some[_]) => 3
case _ => 4
}
@@ -539,17 +539,17 @@ object Test {
case class Operator(x: Int);
val EQ = new Operator(2);
- def analyze(x: Pair[Operator, Int]) = x match {
- case Pair(EQ, 0) => "0"
- case Pair(EQ, 1) => "1"
- case Pair(EQ, 2) => "2"
+ def analyze(x: Tuple2[Operator, Int]) = x match {
+ case (EQ, 0) => "0"
+ case (EQ, 1) => "1"
+ case (EQ, 2) => "2"
}
def run() {
- val x = Pair(EQ, 0);
+ val x = (EQ, 0);
assertEquals("0", analyze(x)); // should print "0"
- val y = Pair(EQ, 1);
+ val y = (EQ, 1);
assertEquals("1", analyze(y)); // should print "1"
- val z = Pair(EQ, 2);
+ val z = (EQ, 2);
assertEquals("2", analyze(z)); // should print "2"
}
}
diff --git a/test/files/run/t3888.scala b/test/files/run/t3888.scala
index 19771041fc..8701b42ff0 100644
--- a/test/files/run/t3888.scala
+++ b/test/files/run/t3888.scala
@@ -24,6 +24,6 @@ object Test {
}
}
-class P extends Pair(1, 1) {
+class P extends Tuple2(1, 1) {
override def equals(x: Any) = true
}
diff --git a/test/files/run/t6329_repl_bug.check b/test/files/run/t6329_repl_bug.check
new file mode 100644
index 0000000000..44c41cfd03
--- /dev/null
+++ b/test/files/run/t6329_repl_bug.check
@@ -0,0 +1,17 @@
+Type in expressions to have them evaluated.
+Type :help for more information.
+
+scala> import scala.reflect.runtime.universe._
+import scala.reflect.runtime.universe._
+
+scala> import scala.reflect.runtime._
+import scala.reflect.runtime._
+
+scala> classManifest[List[_]]
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+res0: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List[<?>]
+
+scala> scala.reflect.classTag[List[_]]
+res1: scala.reflect.ClassTag[List[_]] = scala.collection.immutable.List
+
+scala>
diff --git a/test/files/run/t6329_repl_bug.pending b/test/files/run/t6329_repl_bug.scala
index 9997d1771e..9997d1771e 100644
--- a/test/files/run/t6329_repl_bug.pending
+++ b/test/files/run/t6329_repl_bug.scala
diff --git a/test/files/run/t6329_vanilla_bug.check b/test/files/run/t6329_vanilla_bug.check
new file mode 100644
index 0000000000..640d168a8a
--- /dev/null
+++ b/test/files/run/t6329_vanilla_bug.check
@@ -0,0 +1,3 @@
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
+scala.collection.immutable.List[<?>]
+scala.collection.immutable.List
diff --git a/test/files/run/t6329_vanilla_bug.pending b/test/files/run/t6329_vanilla_bug.scala
index 404f90bf6e..404f90bf6e 100644
--- a/test/files/run/t6329_vanilla_bug.pending
+++ b/test/files/run/t6329_vanilla_bug.scala
diff --git a/test/files/run/t7985.scala b/test/files/run/t7985.scala
new file mode 100644
index 0000000000..5fe270f9c0
--- /dev/null
+++ b/test/files/run/t7985.scala
@@ -0,0 +1,3 @@
+object Test extends App {
+ Array(1) match { case _: Array[scala.Int] => }
+}
diff --git a/test/files/run/t7985b.scala b/test/files/run/t7985b.scala
new file mode 100644
index 0000000000..aaf649eb28
--- /dev/null
+++ b/test/files/run/t7985b.scala
@@ -0,0 +1,5 @@
+class a { type X = Int }
+
+object Test extends App {
+ Array(1) match { case _: Array[a#X] => }
+}
diff --git a/test/files/run/tailcalls.scala b/test/files/run/tailcalls.scala
index e5d8891cc7..1653b14de9 100644
--- a/test/files/run/tailcalls.scala
+++ b/test/files/run/tailcalls.scala
@@ -169,7 +169,7 @@ class TailCall[S](s: S) {
aux[T](x, y);
}
final def g3[T](x: Int, y: Int, zs: List[T]): Int = {
- def aux[U](n: Int, v: Int, ls: List[Pair[T,U]]): Int =
+ def aux[U](n: Int, v: Int, ls: List[Tuple2[T,U]]): Int =
if (n == 0) v else aux(n - 1, v - 1, ls);
aux(x, y, Nil);
}
diff --git a/test/files/run/tcpoly_parseridioms.check b/test/files/run/tcpoly_parseridioms.check
index ab829e0a0e..8bd0a086d6 100644
--- a/test/files/run/tcpoly_parseridioms.check
+++ b/test/files/run/tcpoly_parseridioms.check
@@ -4,8 +4,8 @@ It would fail on the following input: ParseResult()
^
tcpoly_parseridioms.scala:17: warning: match may not be exhaustive.
It would fail on the following input: ParseResult()
- def apply(in: Input): ParseResult[Pair[T, U]] = a(in) match {
- ^
+ def apply(in: Input): ParseResult[Tuple2[T, U]] = a(in) match {
+ ^
tcpoly_parseridioms.scala:30: warning: match may not be exhaustive.
It would fail on the following input: ParseResult()
case Failure(_, _) => b(in) match {
diff --git a/test/files/run/tcpoly_parseridioms.scala b/test/files/run/tcpoly_parseridioms.scala
index c8bcf693a1..d22f68b558 100644
--- a/test/files/run/tcpoly_parseridioms.scala
+++ b/test/files/run/tcpoly_parseridioms.scala
@@ -13,10 +13,10 @@ trait Parsers {
}
// sequence
- def sq[T, U](a: => Parser[T], b: => Parser[U]): Parser[Pair[T, U]] = new Parser[Pair[T, U]] {
- def apply(in: Input): ParseResult[Pair[T, U]] = a(in) match {
+ def sq[T, U](a: => Parser[T], b: => Parser[U]): Parser[Tuple2[T, U]] = new Parser[Tuple2[T, U]] {
+ def apply(in: Input): ParseResult[Tuple2[T, U]] = a(in) match {
case Success(next, x) => b(next) match {
- case Success(next2, y) => Success(next2, Pair(x,y))
+ case Success(next2, y) => Success(next2, (x,y))
case Failure(_, msg) => Failure(in, msg)
}
case Failure(_, msg) => Failure(in, msg)
@@ -49,7 +49,7 @@ trait Parsers {
}
}
- def apply_++[s, tt](fun: Parser[s => tt], arg: Parser[s]): Parser[tt] = lift[Pair[s=>tt, s], tt]({case Pair(f, a) => f(a)})(sq(fun, arg))
+ def apply_++[s, tt](fun: Parser[s => tt], arg: Parser[s]): Parser[tt] = lift[Tuple2[s=>tt, s], tt]({case (f, a) => f(a)})(sq(fun, arg))
def success[u](v: u): Parser[u] = new Parser[u] {
def apply(in: Input) = Success(in, v)
diff --git a/test/files/run/withIndex.scala b/test/files/run/withIndex.scala
index 910b1f1f9e..ebf1941c95 100644
--- a/test/files/run/withIndex.scala
+++ b/test/files/run/withIndex.scala
@@ -11,7 +11,7 @@ object Test {
Console.println(str.zipWithIndex.toList)
assert {
ary.zipWithIndex match {
- case _: Array[Pair[_,_]] => true
+ case _: Array[Tuple2[_,_]] => true
case _ => false
}
}