From 58d972039573bbad67e44760d578c32e134be504 Mon Sep 17 00:00:00 2001 From: Antonio Cunei Date: Thu, 17 Jun 2010 05:35:36 +0000 Subject: Merged revisions 22334 via svnmerge from https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r22334 | extempore | 2010-06-16 23:59:16 +0200 (Wed, 16 Jun 2010) | 4 lines A wholesale reversion of the pattern matcher to r21939, motivated by the appearance of #3578. Closes #3578, reopens #2800, #3050. Review by moors. (I can't keep saying "no review" when every move I make in here seems to break something.) ........ --- test/files/neg/array-not-seq.check | 11 +---------- test/files/pos/bug3578.scala | 30 ++++++++++++++++++++++++++++++ test/files/run/bug3050.scala | 9 --------- 3 files changed, 31 insertions(+), 19 deletions(-) create mode 100644 test/files/pos/bug3578.scala delete mode 100644 test/files/run/bug3050.scala (limited to 'test/files') diff --git a/test/files/neg/array-not-seq.check b/test/files/neg/array-not-seq.check index bd72bb4e13..c16ecdad72 100644 --- a/test/files/neg/array-not-seq.check +++ b/test/files/neg/array-not-seq.check @@ -1,16 +1,7 @@ array-not-seq.scala:2: error: An Array will no longer match as Seq[_]. def f1(x: Any) = x.isInstanceOf[Seq[_]] ^ -array-not-seq.scala:4: error: An Array will no longer match as Seq[_]. - case _: Seq[_] => true - ^ error: An Array will no longer match as Seq[_]. -array-not-seq.scala:16: error: An Array will no longer match as Seq[_]. - case (Some(_: Seq[_]), Nil, _) => 1 - ^ error: An Array will no longer match as Seq[_]. -array-not-seq.scala:15: error: An Array will no longer match as Seq[_]. - def f5(x1: Any, x2: Any, x3: AnyRef) = (x1, x2, x3) match { - ^ error: An Array will no longer match as Seq[_]. -7 errors found +four errors found diff --git a/test/files/pos/bug3578.scala b/test/files/pos/bug3578.scala new file mode 100644 index 0000000000..d984118208 --- /dev/null +++ b/test/files/pos/bug3578.scala @@ -0,0 +1,30 @@ +object Test { + sealed abstract class JValue { + def ++(other: JValue) = { + def append(value1: JValue, value2: JValue): JValue = (value1, value2) match { + case (JNothing, x) => x + case (x, JNothing) => x + case (JObject(xs), x: JField) => JObject(xs ::: List(x)) + case (x: JField, JObject(xs)) => JObject(x :: xs) + case (JArray(xs), JArray(ys)) => JArray(xs ::: ys) + case (JArray(xs), v: JValue) => JArray(xs ::: List(v)) + case (v: JValue, JArray(xs)) => JArray(v :: xs) + case (f1: JField, f2: JField) => JObject(f1 :: f2 :: Nil) + case (JField(n, v1), v2: JValue) => JField(n, append(v1, v2)) + case (x, y) => JArray(x :: y :: Nil) + } + append(this, other) + } + } + + case object JNothing extends JValue + case object JNull extends JValue + case class JString(s: String) extends JValue + case class JDouble(num: Double) extends JValue + case class JInt(num: BigInt) extends JValue + case class JBool(value: Boolean) extends JValue + case class JField(name: String, value: JValue) extends JValue + case class JObject(obj: List[JField]) extends JValue + case class JArray(arr: List[JValue]) extends JValue +} + diff --git a/test/files/run/bug3050.scala b/test/files/run/bug3050.scala deleted file mode 100644 index aaec99ec14..0000000000 --- a/test/files/run/bug3050.scala +++ /dev/null @@ -1,9 +0,0 @@ -object Test { - def main(args: Array[String]): Unit = { - val x = - try { ("": Any) match { case List(_*) => true } } - catch { case _ => false } - - assert(x == false) - } -} -- cgit v1.2.3