diff options
author | Burak Emir <emir@epfl.ch> | 2007-03-22 03:28:30 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2007-03-22 03:28:30 +0000 |
commit | c61121a813abaace6e739a6f02e4c85b186f95a1 (patch) | |
tree | 74e4b0b57269397e888424346f674efcd933efc4 /test/files/neg | |
parent | 8e890c848ff68e69342d0f340df40f926857c861 (diff) | |
download | scala-c61121a813abaace6e739a6f02e4c85b186f95a1.tar.gz scala-c61121a813abaace6e739a6f02e4c85b186f95a1.tar.bz2 scala-c61121a813abaace6e739a6f02e4c85b186f95a1.zip |
new pattern matching algo
removed "removeoption"
changed SUnit and some tests
added useful debug msg in typer
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/patmatexhaust.check | 32 | ||||
-rw-r--r-- | test/files/neg/patmatexhaust.scala | 8 |
2 files changed, 25 insertions, 15 deletions
diff --git a/test/files/neg/patmatexhaust.check b/test/files/neg/patmatexhaust.check index 19e79b2928..719f98b8d3 100644 --- a/test/files/neg/patmatexhaust.check +++ b/test/files/neg/patmatexhaust.check @@ -1,23 +1,27 @@ -patmatexhaust.scala:8: warning: does not cover case {object Baz} +patmatexhaust.scala:7: warning: match is not exhaustive! +missing combination Baz + def ma1(x:Foo) = x match { ^ -patmatexhaust.scala:12: warning: does not cover case {class Bar} +patmatexhaust.scala:11: warning: match is not exhaustive! +missing combination Bar + def ma2(x:Foo) = x match { ^ -patmatexhaust.scala:24: warning: does not cover case {class Kult} - case (Kult(_), Qult()) => // Kult missing - ^ -patmatexhaust.scala:26: warning: does not cover case {class Qult} - case (Qult(), Kult(_)) => // Qult missing - ^ -patmatexhaust.scala:44: warning: does not cover cases {object Gu,class Gp} +patmatexhaust.scala:23: warning: match is not exhaustive! +missing combination Kult Kult +missing combination Qult Qult + + def ma3(x:Mult) = (x,x) match { // not exhaustive + ^ +patmatexhaust.scala:49: warning: match is not exhaustive! +missing combination Gu +missing combination Gp + def ma4(x:Deep) = x match { // missing cases: Gu, Gp ^ -patmatexhaust.scala:51: warning: does not cover case {class Gp} - case Ga => - ^ -patmatexhaust.scala:65: error: unreachable code +patmatexhaust.scala:70: error: unreachable code case 1 => ^ -6 warnings found +four warnings found one error found diff --git a/test/files/neg/patmatexhaust.scala b/test/files/neg/patmatexhaust.scala index 204bf2f170..b2d0b8ddd2 100644 --- a/test/files/neg/patmatexhaust.scala +++ b/test/files/neg/patmatexhaust.scala @@ -1,5 +1,4 @@ class TestSealedExhaustive { // compile only - sealed class Foo case class Bar(x:Int) extends Foo @@ -20,6 +19,7 @@ class TestSealedExhaustive { // compile only def ma33(x:Kult) = x match { // exhaustive case Kult(_) => // exhaustive } + def ma3(x:Mult) = (x,x) match { // not exhaustive case (Kult(_), Qult()) => // Kult missing //case Pair(Kult(_), Kult(_)) => @@ -27,6 +27,11 @@ class TestSealedExhaustive { // compile only //case Pair(Qult(), Qult()) => } + def ma3u(x:Mult) = ((x,x) : @unchecked) match { // not exhaustive, but not checked! + case (Kult(_), Qult()) => + case (Qult(), Kult(_)) => + } + sealed class Deep case object Ga extends Deep @@ -64,4 +69,5 @@ class TestSealedExhaustive { // compile only case 1 => case 1 => } + } |