Skip to content

nested pattern can't used named params when outer does not #23181

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
bishabosha opened this issue May 18, 2025 · 0 comments
Open

nested pattern can't used named params when outer does not #23181

bishabosha opened this issue May 18, 2025 · 0 comments
Labels
area:named-tuples Issues tied to the named tuples feature. itype:bug

Comments

@bishabosha
Copy link
Member

Compiler version

3.7.0

Minimized code

case class Account(b: Balance, data: List[AnyRef])
case class Balance(acc: String, balance: AnyRef) // simplified
def reportUncategorised(acc: Account): Unit =
  val Account(Balance(acc = kind), data) = acc

Output

-- Error: ----------------------------------------------------------------------
4 |  val Account(Balance(acc = kind), data) = acc
  |                      ^
  |                   Illegal combination of named and unnamed tuple elements
1 error found

Expectation

I thought this error only applied within the same constructor - i.e. Balance, it should not care that Account uses positional patterns surely.

@bishabosha bishabosha added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 18, 2025
@Gedochao Gedochao added 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 21, 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. itype:bug
Projects
None yet
Development

No branches or pull requests

2 participants