summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-04-21 20:44:43 +0200
committerJason Zaugg <jzaugg@gmail.com>2014-04-21 20:44:43 +0200
commitc3125fba6f14dd3fa5f86ec01637cbe896e9345e (patch)
tree911d1096c35b3c5809d9d2422fce2d37f1ab74a4 /test
parent82d1b4042ccd687541d9b8b9032b7f2330a78b48 (diff)
parent4a16b044baf8377e04624207202e83c78a0a49cf (diff)
downloadscala-c3125fba6f14dd3fa5f86ec01637cbe896e9345e.tar.gz
scala-c3125fba6f14dd3fa5f86ec01637cbe896e9345e.tar.bz2
scala-c3125fba6f14dd3fa5f86ec01637cbe896e9345e.zip
Merge pull request #3645 from retronym/ticket/8430
SI-8430 Less non-determinism in patmat exhautiveness warnings
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t8430.check27
-rw-r--r--test/files/neg/t8430.flags1
-rw-r--r--test/files/neg/t8430.scala32
3 files changed, 60 insertions, 0 deletions
diff --git a/test/files/neg/t8430.check b/test/files/neg/t8430.check
new file mode 100644
index 0000000000..7c6a73ce53
--- /dev/null
+++ b/test/files/neg/t8430.check
@@ -0,0 +1,27 @@
+t8430.scala:15: warning: match may not be exhaustive.
+It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ ^
+t8430.scala:16: warning: match may not be exhaustive.
+It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ ^
+t8430.scala:17: warning: match may not be exhaustive.
+It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ ^
+t8430.scala:18: warning: match may not be exhaustive.
+It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ ^
+t8430.scala:19: warning: match may not be exhaustive.
+It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ ^
+t8430.scala:20: warning: match may not be exhaustive.
+It would fail on the following inputs: ??, LetC, LetF, LetL(IntLit), LetP
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+6 warnings found
+one error found
diff --git a/test/files/neg/t8430.flags b/test/files/neg/t8430.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/neg/t8430.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/neg/t8430.scala b/test/files/neg/t8430.scala
new file mode 100644
index 0000000000..4166b08a0a
--- /dev/null
+++ b/test/files/neg/t8430.scala
@@ -0,0 +1,32 @@
+sealed trait CL3Literal
+case object IntLit extends CL3Literal
+case object CharLit extends CL3Literal
+case object BooleanLit extends CL3Literal
+case object UnitLit extends CL3Literal
+
+
+sealed trait Tree
+case class LetL(value: CL3Literal) extends Tree
+case object LetP extends Tree
+case object LetC extends Tree
+case object LetF extends Tree
+
+object Test {
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ (tree: Tree) => tree match {case LetL(CharLit) => ??? }
+ // After the first patch for SI-8430, we achieve stability: all of
+ // these get the same warning:
+ //
+ // ??, LetC, LetF, LetL(IntLit), LetP
+ //
+ // Before, it was non-deterministic.
+ //
+ // However, we our list of counter examples is itself non-exhaustive.
+ // We need to rework counter example generation to fix that.
+ //
+ // That work is the subject of SI-7746
+}