Skip to content

Extractor returning NamedTuple is not considered exhaustive #23158

Open
@eejbyfeldt

Description

@eejbyfeldt

Compiler version

3.7.0, 3.7.1-RC1

Minimized code

object Unpack {
  final case class Pair(a: Int, b: Int)
  def unapply(e: Pair): NamedTuple.NamedTuple[("a", "b"), (Int, Int)] = ???

  val x: Pair = ???
  x match {
    case Unpack(_, _) => ???
  }
}

Output

Produces the following warning

 
-- [E029] Pattern Match Exhaustivity Warning: extractor_namedtuple.scala:6:2 -----------------
6 |  x match {
  |  ^
  |  match may not be exhaustive.
  |
  |  It would fail on pattern case: Unpack()
  |
  | longer explanation available when compiling with `-explain`
1 warning found

Expectation

Should compile without warnings.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions