summaryrefslogtreecommitdiff
path: root/test/files/neg/t8430.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-03-21 11:54:02 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-03-24 10:50:00 +0100
commit4a16b044baf8377e04624207202e83c78a0a49cf (patch)
tree7794c86def6398d8d28ef74f7314f3390b6a1310 /test/files/neg/t8430.scala
parentbcf24ec9ba07408ad9e8745135cc941ac3e76289 (diff)
downloadscala-4a16b044baf8377e04624207202e83c78a0a49cf.tar.gz
scala-4a16b044baf8377e04624207202e83c78a0a49cf.tar.bz2
scala-4a16b044baf8377e04624207202e83c78a0a49cf.zip
SI-8430 Less non-determinism in patmat exhautiveness warnings
Another mole whacked on the head by using `LinkedHashMap`. Caution: `LinkedHashMap` doesn't preserve its runtime type if you map through the generic interface. I've noted this gotcha as SI-8434. I've structured this patch to enforce that concrete collection with types, which is a good idea anyway. My method to track this down was to place breakpoints in `Hash{Map,Set}`.{foreach,iterator}` to see where that was used from within pattern match translation. This approach was drastically faster than my previous rounds of whack-a-mole. The counter-examples are still a bit off; I'm going to merge that aspect of this ticket with SI-7746, in which we've pinpointed the culpable part of the implementation, but haven't had success in fixing the bug.
Diffstat (limited to 'test/files/neg/t8430.scala')
-rw-r--r--test/files/neg/t8430.scala32
1 files changed, 32 insertions, 0 deletions
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
+}