Skip to content

Wrong exhaustive check with sequence wildcard on case class with custom unapply #23459

Open
@SrTobi

Description

@SrTobi

Compiler version

3.7.1

Minimized code

case class Test()
object Test {
  def unapply(int: Test): Some[Seq[Int]] = Some(Seq(1, 2))
}

@main
def run = {
  Test() match {
    case Test(x*) => println(x)
  }
}

Output

Compiles, runs and prints List(1, 2), but has the following warning:

match may not be exhaustive.

It would fail on pattern case: Test(_)

    Test() match {

Expectation

The compiler should not emit any error because of the exhaustive check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions