summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2013-07-29 09:43:42 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2013-07-29 09:43:42 -0700
commitcf5bd70ce77f659b18cb4f326f9354f5e052277a (patch)
tree6cd35fba3e21c7e9d5b27af18e40f83694e8009f /test/files/neg
parent9c5c46423546ffc4f331130648985b04626d38cb (diff)
parent635892e34119d2e4b82fbced5b9d8cbd6dd064b7 (diff)
downloadscala-cf5bd70ce77f659b18cb4f326f9354f5e052277a.tar.gz
scala-cf5bd70ce77f659b18cb4f326f9354f5e052277a.tar.bz2
scala-cf5bd70ce77f659b18cb4f326f9354f5e052277a.zip
Merge pull request #2737 from retronym/ticket/7669
SI-7669 Fix exhaustivity warnings for recursive ADTs.
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/exhausting.check2
-rw-r--r--test/files/neg/exhausting.scala2
-rw-r--r--test/files/neg/t7669.check7
-rw-r--r--test/files/neg/t7669.flags1
-rw-r--r--test/files/neg/t7669.scala13
5 files changed, 23 insertions, 2 deletions
diff --git a/test/files/neg/exhausting.check b/test/files/neg/exhausting.check
index c573eb3e15..619849693c 100644
--- a/test/files/neg/exhausting.check
+++ b/test/files/neg/exhausting.check
@@ -1,5 +1,5 @@
exhausting.scala:21: warning: match may not be exhaustive.
-It would fail on the following input: List(_, _, _)
+It would fail on the following inputs: List(_), List(_, _, _)
def fail1[T](xs: List[T]) = xs match {
^
exhausting.scala:27: warning: match may not be exhaustive.
diff --git a/test/files/neg/exhausting.scala b/test/files/neg/exhausting.scala
index 5554ee2671..01c34f7039 100644
--- a/test/files/neg/exhausting.scala
+++ b/test/files/neg/exhausting.scala
@@ -17,7 +17,7 @@ object Test {
case (_: Foo[_], _: Foo[_]) => ()
}
- // fails for: ::(_, ::(_, ::(_, _)))
+ // fails for: ::(_, Nil), ::(_, ::(_, ::(_, _))), ...
def fail1[T](xs: List[T]) = xs match {
case Nil => "ok"
case x :: y :: Nil => "ok"
diff --git a/test/files/neg/t7669.check b/test/files/neg/t7669.check
new file mode 100644
index 0000000000..c090ed18ce
--- /dev/null
+++ b/test/files/neg/t7669.check
@@ -0,0 +1,7 @@
+t7669.scala:9: warning: match may not be exhaustive.
+It would fail on the following input: NotHandled(_)
+ def exhausto(expr: Expr): Unit = expr match {
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t7669.flags b/test/files/neg/t7669.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/t7669.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/t7669.scala b/test/files/neg/t7669.scala
new file mode 100644
index 0000000000..12441ec056
--- /dev/null
+++ b/test/files/neg/t7669.scala
@@ -0,0 +1,13 @@
+object Test {
+
+ sealed abstract class Expr
+ // Change type of `arg` to `Any` and the exhaustiveness warning
+ // is issued below
+ case class Op(arg: Expr) extends Expr
+ case class NotHandled(num: Double) extends Expr
+
+ def exhausto(expr: Expr): Unit = expr match {
+ case Op(Op(_)) =>
+ case Op(_) =>
+ }
+}