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 binding from IArray.unapplySeq pattern can't select fields. #22150

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

Comments

@bishabosha
Copy link
Member

bishabosha commented Dec 5, 2024

Compiler version

3.6.2-RC3

Minimized code

//> using options -experimental -language:experimental.namedTuples
val dirs = IArray(
  (dx = 0, dy = 1), // up
  (dx = 1, dy = 0), // right
  (dx = 0, dy = -1), // down
  (dx = -1, dy = 0), // left
)

val IArray(Up @ _, _, _, _) = dirs

def Test = println(Up.dx)

Output

-- [E008] Not Found Error: -----------------------------------------------------
10 |def Test = println(Up.dx)
   |                   ^^^^^
   |value dx is not a member of Array.UnapplySeqWrapper[? <: (dx : Int, dy : Int)]#T
1 error found

Expectation

selection should work, like it does if the pattern were Array.unapplySeq or Seq.unapplySeq

@bishabosha bishabosha added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Dec 5, 2024
@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 Dec 6, 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. itype:bug
Projects
None yet
Development

No branches or pull requests

3 participants