Skip to content

Named Tuple binding from IArray.unapplySeq pattern can't select fields. #22150

Closed
@bishabosha

Description

@bishabosha

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions