diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2016-01-27 19:01:25 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2016-01-29 11:10:30 +1000 |
commit | 1f4d8945f310ad803d7c165e0f53baf3c9194cf6 (patch) | |
tree | d911b6ee46c868352624f19fdf7c4b0b98bbbebe /test/files/neg/t9398 | |
parent | 79a52e6807d2797dee12bab1730765441a0e222d (diff) | |
download | scala-1f4d8945f310ad803d7c165e0f53baf3c9194cf6.tar.gz scala-1f4d8945f310ad803d7c165e0f53baf3c9194cf6.tar.bz2 scala-1f4d8945f310ad803d7c165e0f53baf3c9194cf6.zip |
SI-9398 Treat case classes as one-element ADTs for analysis
Currently, exhaustivity analysis only runs for scrutinees with
a sealed type.
This commit treats any case class as a one-element, sealed type
to enable additional analysis, such as in the new test case.
Diffstat (limited to 'test/files/neg/t9398')
-rw-r--r-- | test/files/neg/t9398/data.scala | 5 | ||||
-rw-r--r-- | test/files/neg/t9398/match.scala | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/test/files/neg/t9398/data.scala b/test/files/neg/t9398/data.scala new file mode 100644 index 0000000000..7a98c0e8e8 --- /dev/null +++ b/test/files/neg/t9398/data.scala @@ -0,0 +1,5 @@ +sealed abstract class TB +case object B extends TB +case object B2 extends TB + +case class CC(tb: TB) diff --git a/test/files/neg/t9398/match.scala b/test/files/neg/t9398/match.scala new file mode 100644 index 0000000000..e110c6a96a --- /dev/null +++ b/test/files/neg/t9398/match.scala @@ -0,0 +1,6 @@ +class Test { + // Should warn that CC(B2) isn't matched + def test(c: CC): Unit = c match { + case CC(B) => () + } +} |