summaryrefslogtreecommitdiff
path: root/test/files/run/patmatnew.scala
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2007-02-05 17:17:17 +0000
committerBurak Emir <emir@epfl.ch>2007-02-05 17:17:17 +0000
commit2f4f3d3db7c2eb9ed535065ffed8098a99de0278 (patch)
treed3d8c20356bd8f76d1b4b7aa298507232ae028cb /test/files/run/patmatnew.scala
parent912077c5f8d59b2585a3a5014c193a8399b672d1 (diff)
downloadscala-2f4f3d3db7c2eb9ed535065ffed8098a99de0278.tar.gz
scala-2f4f3d3db7c2eb9ed535065ffed8098a99de0278.tar.bz2
scala-2f4f3d3db7c2eb9ed535065ffed8098a99de0278.zip
exhaustivity reworked
Diffstat (limited to 'test/files/run/patmatnew.scala')
-rw-r--r--test/files/run/patmatnew.scala37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala
index 10b0021f0f..749b0bc21d 100644
--- a/test/files/run/patmatnew.scala
+++ b/test/files/run/patmatnew.scala
@@ -14,6 +14,7 @@ trait Shmeez extends AnyRef with Treez {
}
object Test {
+/*
import scala.testing.SUnit._
def main(args:Array[String]): Unit = {
@@ -81,4 +82,40 @@ object Test {
}
}
}
+
+
+ // these are exhaustive matches
+ // should not generate any warnings
+ def f[A](z:{Option[A],Option[A]}) = z match {
+ case {None,Some(x)} => 1
+ case {Some(x),None } => 2
+ case {Some(x),Some(y)} => 3
+ case _ => 4
+ }
+
+ def g1[A](z:Option[List[A]]) = z match {
+ case Some(Nil) => true
+ case Some(x::Nil) => true
+ case _ => true
+ }
+
+ def g2[A](z:Option[List[A]]) = z match {
+ case Some(x::Nil) => true
+ case Some(_) => false
+ case _ => true
+ }
+
+ def h[A](x:{Option[A],Option[A]}) = x match {
+ case {None,_:Some[_]} => 1
+ case {_:Some[_],None } => 2
+ case {_:Some[_],_:Some[_]} => 3
+ case _ => 4
+ }
+*/
+ def i = List(1,2) match {
+ case List(1) =>
+ case List(1,2,xs @ _*) =>
+ case Nil =>
+ }
}
+