Skip to content

False exhaustivity warning for seq match #23928

@Eastsun

Description

@Eastsun

Compiler version

3.7.2, 3.7.3

Minimized code

Nil match {case Seq(xs*) => println(xs);}

Output

-- [E029] Pattern Match Exhaustivity Warning:
  |Nil match {case Seq(xs*) => println(xs);}
  |^^^
  |match may not be exhaustive.
  |
  |It would fail on pattern case: Seq(_, _*)
  |
  | longer explanation available when compiling with `-explain`

And

Nil match {case Seq(xs*) => println(xs); case Seq(_, _*) => println()}

with two warnnings

2 warnings found
-- [E029] Pattern Match Exhaustivity Warning:  
  |Nil match {case Seq(xs*) => println(xs); case Seq(_, _*) => println()}
  |^^^
  |match may not be exhaustive.
  |
  |It would fail on pattern case: Seq(_, _*)
  |
  | longer explanation available when compiling with `-explain`
-- [E030] Match case Unreachable Warning:
  |Nil match {case Seq(xs*) => println(xs); case Seq(_, _*) => println()}
  |                                              ^^^^^^^^^^
  |                                              Unreachable case

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions