aboutsummaryrefslogtreecommitdiff
path: root/tests/patmat/t8700a
diff options
context:
space:
mode:
authorliu fengyun <liufengyunchina@gmail.com>2016-07-21 10:45:14 +0200
committerliu fengyun <liufengyunchina@gmail.com>2016-08-24 10:26:59 +0200
commitcc02243fbe8b7290265e1bdf540e4c2f256df199 (patch)
treebd83dcabb8de09fa48b9373b9431ef8c481da5ed /tests/patmat/t8700a
parent1a7618f32c6d8060c3a87ce633645440d500aa7a (diff)
downloaddotty-cc02243fbe8b7290265e1bdf540e4c2f256df199.tar.gz
dotty-cc02243fbe8b7290265e1bdf540e4c2f256df199.tar.bz2
dotty-cc02243fbe8b7290265e1bdf540e4c2f256df199.zip
add test set for exhaustivity and redundancy check
Diffstat (limited to 'tests/patmat/t8700a')
-rw-r--r--tests/patmat/t8700a/Bar.scala9
-rw-r--r--tests/patmat/t8700a/Baz.java11
-rw-r--r--tests/patmat/t8700a/Foo.java4
-rw-r--r--tests/patmat/t8700a/expected.check9
4 files changed, 33 insertions, 0 deletions
diff --git a/tests/patmat/t8700a/Bar.scala b/tests/patmat/t8700a/Bar.scala
new file mode 100644
index 000000000..33ad8e987
--- /dev/null
+++ b/tests/patmat/t8700a/Bar.scala
@@ -0,0 +1,9 @@
+object Bar {
+ def bar1(foo: Foo) = foo match {
+ case Foo.A => 1
+ }
+
+ def bar2(foo: Baz) = foo match {
+ case Baz.A => 1
+ }
+}
diff --git a/tests/patmat/t8700a/Baz.java b/tests/patmat/t8700a/Baz.java
new file mode 100644
index 000000000..49f15e121
--- /dev/null
+++ b/tests/patmat/t8700a/Baz.java
@@ -0,0 +1,11 @@
+public enum Baz {
+ A {
+ public void baz1() {}
+ },
+ B {
+ public void baz1() {}
+ };
+
+ public abstract void baz1();
+ public void baz2() {}
+}
diff --git a/tests/patmat/t8700a/Foo.java b/tests/patmat/t8700a/Foo.java
new file mode 100644
index 000000000..cc8e9daf1
--- /dev/null
+++ b/tests/patmat/t8700a/Foo.java
@@ -0,0 +1,4 @@
+public enum Foo {
+ A,
+ B
+}
diff --git a/tests/patmat/t8700a/expected.check b/tests/patmat/t8700a/expected.check
new file mode 100644
index 000000000..83f1c5a9e
--- /dev/null
+++ b/tests/patmat/t8700a/expected.check
@@ -0,0 +1,9 @@
+./tests/patmat/t8700a/Bar.scala:2: warning: match may not be exhaustive.
+It would fail on the following input: B
+ def bar1(foo: Foo) = foo match {
+ ^
+./tests/patmat/t8700a/Bar.scala:6: warning: match may not be exhaustive.
+It would fail on the following input: B
+ def bar2(foo: Baz) = foo match {
+ ^
+two warnings found