Aladdin - Scala Bugtracking
[#931] project: compiler priority: low category: feature
submitter assigned to status date submitted
Martin Burak won't fix 2007-02-03 10:53:26.0
subject spurious pattern warnings
code
scalac List.scala
what happened
List.scala:802: warning: does not cover case {object Nil}
        case hd1::hd2::hd3::tail => {
                     ^
List.scala:802: warning: does not cover case {object Nil}
        case hd1::hd2::hd3::tail => {
                          ^
List.scala:823: warning: does not cover case {object Nil}
      case hd1::hd2::hd3::tail => {
                   ^
List.scala:823: warning: does not cover case {object Nil}
      case hd1::hd2::hd3::tail => {
                        ^
four warnings found
what expected no warnings
[back to overview]
Changes of this bug report
Burak  edited on  2007-02-03 11:59:31.0
This warning is not spurious, since indeed there are not subsequent patterns that check the Nil cases.
A way to get rid of it would be to use a pattern like List(hd1,hd2,hd3,tail@_*).
The alternative would be to give up warnings for a whole pattern match whenever one unapply pattern is found -- this I find too drastic, since having coverage for nested patterns seems like a big plus.