diff options
author | Paul Phillips <paulp@improving.org> | 2010-06-16 21:59:16 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-06-16 21:59:16 +0000 |
commit | f750b08d9e8121c32cd433ee167cbc95705429ed (patch) | |
tree | 380382b7a2dd2291f9c8231e3d5f29f088e311d7 /test | |
parent | 9e0618ba29426ea5cb12caf881ce892a1d2365b9 (diff) | |
download | scala-f750b08d9e8121c32cd433ee167cbc95705429ed.tar.gz scala-f750b08d9e8121c32cd433ee167cbc95705429ed.tar.bz2 scala-f750b08d9e8121c32cd433ee167cbc95705429ed.zip |
A wholesale reversion of the pattern matcher to...
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.)
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/array-not-seq.check | 11 | ||||
-rw-r--r-- | test/files/pos/bug3578.scala | 30 | ||||
-rw-r--r-- | test/pending/run/bug3050.scala (renamed from test/files/run/bug3050.scala) | 0 |
3 files changed, 31 insertions, 10 deletions
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/pending/run/bug3050.scala index aaec99ec14..aaec99ec14 100644 --- a/test/files/run/bug3050.scala +++ b/test/pending/run/bug3050.scala |