Skip to content

New patmat warnings on destructure #12245

@japgolly

Description

@japgolly

reproduction steps

using Scala 2.13.4

val List(x, y) = List(1, 2)

problem

Warning appears:

[error] It would fail on the following inputs: List(_), Nil
[error]       val List(x, y) = List(1, 2)

There wasn't a warning until 2.13.4.

Should the new patmat strictness (which is awesome btw) apply to destructures like this? It would be valuable in this case:

val a = List(1, 2)
val List(x, y) = a

but when the right-hand side is a single known and specific pattern (in our case _ :: _ :: Nil), the warning is spurious.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions