Skip to content

When Fields in Selectable comes from type alias of named tuple. the fields are not selectable #22018

Closed
@kavedaa

Description

@kavedaa

Compiler version

3.6.4-RC1-bin-20241122-64411b6-NIGHTLY and earlier

Minimized code

import scala.language.experimental.namedTuples

class SelectableNT[A <: NamedTuple.AnyNamedTuple](val nt: A) extends Selectable:
  type Fields = A
  def selectDynamic(x: String) = ???

object Test:

  val a = (name = "foo", age = 1)

  val sa = SelectableNT(a)
  sa.name   // ok

  type B = a.type  
  val b: B = a

  val sb = SelectableNT(b)
  sb.name   // fails

Output

value name is not a member of bug.SelectableNT[(bug.Test.a : (name : String, age : Int))]

Expectation

Successful compilation

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions