Skip to content

named tuple patterns break exhaustivity checks #22245

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

Closed
bishabosha opened this issue Dec 19, 2024 · 0 comments · Fixed by #22658
Closed

named tuple patterns break exhaustivity checks #22245

bishabosha opened this issue Dec 19, 2024 · 0 comments · Fixed by #22658
Assignees
Labels
area:named-tuples Issues tied to the named tuples feature. area:pattern-matching itype:bug
Milestone

Comments

@bishabosha
Copy link
Member

bishabosha commented Dec 19, 2024

Compiler version

3.6.2

Minimized code

//> using options -language:experimental.namedTuples

def find(explore: List[(seen: Set[Int], x: Int, y: Int)]): Any =
  explore match
    case Nil => ???
    case (seen = s, x = x, y = y) :: rest => ???

Output

-- [E029] Pattern Match Exhaustivity Warning: ----------------------------------
2 |  explore match
  |  ^^^^^^^
  |  match may not be exhaustive.
  |
  |  It would fail on pattern case: List(_, _*)
  |
  | longer explanation available when compiling with `-explain`

Expectation

the named tuple pattern will always match, so no warning

@bishabosha bishabosha added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Dec 19, 2024
@Gedochao Gedochao added 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 Dec 20, 2024
@Gedochao Gedochao assigned aherlihy and KacperFKorban and unassigned aherlihy Dec 20, 2024
@Gedochao Gedochao assigned bracevac and unassigned KacperFKorban Jan 20, 2025
bracevac added a commit that referenced this issue Feb 25, 2025
@WojciechMazur WojciechMazur added this to the 3.7.0 milestone Mar 11, 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 itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants