Skip to content

Extractor returning NamedTuple is not considered exhaustive #23158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
eejbyfeldt opened this issue May 14, 2025 · 0 comments
Open

Extractor returning NamedTuple is not considered exhaustive #23158

eejbyfeldt opened this issue May 14, 2025 · 0 comments
Labels
area:named-tuples Issues tied to the named tuples feature. area:pattern-matching area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug

Comments

@eejbyfeldt
Copy link

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.

@eejbyfeldt eejbyfeldt added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 14, 2025
@Gedochao Gedochao added area:reporting Error reporting including formatting, implicit suggestions, etc area:pattern-matching area:named-tuples Issues tied to the named tuples feature. and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:named-tuples Issues tied to the named tuples feature. area:pattern-matching area:reporting Error reporting including formatting, implicit suggestions, etc itype:bug
Projects
None yet
Development

No branches or pull requests

2 participants