Skip to content
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

named tuple patterns break exhaustivity checks #22245

Open
bishabosha opened this issue Dec 19, 2024 · 0 comments
Open

named tuple patterns break exhaustivity checks #22245

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

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
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

No branches or pull requests

4 participants