diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-05-28 05:29:09 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-05-28 05:29:09 -0700 |
commit | 6da73dd38d6dd7d8b463520bf54fc79975afc2a0 (patch) | |
tree | 60b381e92051e22abaf3c98f5e88de3ca6910d7b /test | |
parent | ac3fdfddb64a93a17f414e34692b2fd86e7f4746 (diff) | |
parent | 7d0fdb37f4ae4555a51e13b17cca3e8ec94dd9d1 (diff) | |
download | scala-6da73dd38d6dd7d8b463520bf54fc79975afc2a0.tar.gz scala-6da73dd38d6dd7d8b463520bf54fc79975afc2a0.tar.bz2 scala-6da73dd38d6dd7d8b463520bf54fc79975afc2a0.zip |
Merge pull request #635 from adriaanm/topic/virtpatmat
fixes for exhaustivity
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/patmatexhaust.check | 6 | ||||
-rw-r--r-- | test/files/pos/exhaustive_heuristics.scala | 12 |
2 files changed, 12 insertions, 6 deletions
diff --git a/test/files/neg/patmatexhaust.check b/test/files/neg/patmatexhaust.check index 6172811e13..1168f36e11 100644 --- a/test/files/neg/patmatexhaust.check +++ b/test/files/neg/patmatexhaust.check @@ -18,10 +18,6 @@ patmatexhaust.scala:53: error: match may not be exhaustive. It would fail on the following input: Gp() def ma5(x:Deep) = x match { ^ -patmatexhaust.scala:59: error: match may not be exhaustive. -It would fail on the following input: Nil - def ma6() = List(1,2) match { // give up - ^ patmatexhaust.scala:75: error: match may not be exhaustive. It would fail on the following input: B() def ma9(x: B) = x match { @@ -38,4 +34,4 @@ patmatexhaust.scala:126: error: match may not be exhaustive. It would fail on the following input: C1() def ma10(x: C) = x match { // not exhaustive: C1 is not abstract. ^ -10 errors found +9 errors found diff --git a/test/files/pos/exhaustive_heuristics.scala b/test/files/pos/exhaustive_heuristics.scala index f6bea455a5..297900510b 100644 --- a/test/files/pos/exhaustive_heuristics.scala +++ b/test/files/pos/exhaustive_heuristics.scala @@ -12,5 +12,15 @@ object Test { case _ if turnOffChecks => } - // TODO: we back off when there are any user-defined extractors + // we back off when there are any user-defined extractors + // in fact this is exhaustive, but we pretend we don't know since List's unapplySeq is not special to the compiler + // to compensate our ignorance, we back off + // well, in truth, we do rewrite List() to Nil, but otherwise we do nothing + // the full rewrite List(a, b) to a :: b :: Nil, for example is planned (but not sure it's a good idea) + List(true, false) match { + case List(_, _, _*) => + case List(node, _*) => + case Nil => + } + }
\ No newline at end of file |