Skip to content

Refine bind tuple pattern typing for named tuples #23380

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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

noti0na1
Copy link
Member

@noti0na1 noti0na1 commented Jun 16, 2025

ef getNamedTuple: (x: Int, y: String) = (x = 42, y = "Hello")

getNamedTuple match
  case t @ (a, b) => 
    // Although the pattern is a regular tuple, we are not able to call `._i` on t
    t._1 // error, _1 is not a member of named tuple

@noti0na1
Copy link
Member Author

If named tuple is a Product (#22037), then we may not need this fix. However, it is probably more difficult to make it a Product now.

@noti0na1 noti0na1 marked this pull request as ready for review June 16, 2025 12:35
@noti0na1 noti0na1 requested a review from odersky June 16, 2025 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant