diff options
author | Burak Emir <emir@epfl.ch> | 2007-02-05 17:17:17 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2007-02-05 17:17:17 +0000 |
commit | 2f4f3d3db7c2eb9ed535065ffed8098a99de0278 (patch) | |
tree | d3d8c20356bd8f76d1b4b7aa298507232ae028cb /test/files/neg | |
parent | 912077c5f8d59b2585a3a5014c193a8399b672d1 (diff) | |
download | scala-2f4f3d3db7c2eb9ed535065ffed8098a99de0278.tar.gz scala-2f4f3d3db7c2eb9ed535065ffed8098a99de0278.tar.bz2 scala-2f4f3d3db7c2eb9ed535065ffed8098a99de0278.zip |
exhaustivity reworked
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/patmatexhaust.check | 11 | ||||
-rw-r--r-- | test/files/neg/patmatexhaust.scala | 10 |
2 files changed, 14 insertions, 7 deletions
diff --git a/test/files/neg/patmatexhaust.check b/test/files/neg/patmatexhaust.check index 40054bad9f..6a0eda5861 100644 --- a/test/files/neg/patmatexhaust.check +++ b/test/files/neg/patmatexhaust.check @@ -10,11 +10,14 @@ patmatexhaust.scala:24: warning: does not cover case {class Kult} patmatexhaust.scala:26: warning: does not cover case {class Qult} case {Qult(), Kult(_)} => // Qult missing ^ -patmatexhaust.scala:45: warning: does not cover case {object Gu} - def ma4(x:Deep) = x match { // missing cases: Gu +patmatexhaust.scala:44: warning: does not cover cases {object Gu,class Gp} + def ma4(x:Deep) = x match { // missing cases: Gu, Gp ^ -patmatexhaust.scala:57: error: unreachable code +patmatexhaust.scala:51: warning: does not cover case {class Gp} + case Ga => + ^ +patmatexhaust.scala:65: error: unreachable code case 1 => ^ -5 warnings found +6 warnings found one error found diff --git a/test/files/neg/patmatexhaust.scala b/test/files/neg/patmatexhaust.scala index aaa32cda24..7370868363 100644 --- a/test/files/neg/patmatexhaust.scala +++ b/test/files/neg/patmatexhaust.scala @@ -27,7 +27,6 @@ class TestSealedExhaustive { // compile only //case {Qult(), Qult()} => } - sealed class Deep case object Ga extends Deep @@ -42,11 +41,11 @@ class TestSealedExhaustive { // compile only case _ => } - def ma4(x:Deep) = x match { // missing cases: Gu + def ma4(x:Deep) = x match { // missing cases: Gu, Gp case Ga => } - def zma5(x:Deep) = x match { // exhaustive + def ma5(x:Deep) = x match { // Gp case Gu => case _ if 1 == 0 => case Ga => @@ -56,6 +55,11 @@ class TestSealedExhaustive { // compile only case List(1,2) => case x :: xs => } + + def ma7 = List(1,2) match { //exhaustive + case 1::2::Nil => + case _ => + } def redundant = 1 match { // include this otherwise script won't test this in files/neg case 1 => case 1 => |