-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Closed
Copy link
Labels
area:named-tuplesIssues tied to the named tuples feature.Issues tied to the named tuples feature.itype:bug
Description
Compiler version
3.6.3, 3.7.0-RC1-bin-20250222-4dc4668-NIGHTLY
Minimized code
package bug
import scala.language.experimental.namedTuples
object ExhibitA: // fails
class SelectableNT[N <: Tuple] extends Selectable:
def selectDynamic(name: String) = ???
type Names = Tuple.Map[N, [X] =>> X]
type Fields = NamedTuple.NamedTuple[Names, (String, Int)]
val x = new SelectableNT[("name", "age")]
x.name // fails
object ExhibitB: // works
class SelectableNT[N <: Tuple] extends Selectable:
def selectDynamic(name: String) = ???
type Fields = NamedTuple.NamedTuple[N, (String, Int)]
val x = new SelectableNT[("name", "age")]
x.name
object ExhibitC: // works
class SelectableNT[N <: Tuple] extends Selectable:
def selectDynamic(name: String) = ???
type Fields = NamedTuple.NamedTuple[N, (String, Int)]
type N = ("name", "age")
val x = new SelectableNT[N]
x.name
object ExhibitD: // works
class SelectableNT[N <: Tuple] extends Selectable:
def selectDynamic(name: String) = ???
type Fields = NamedTuple.NamedTuple[N, (String, Int)]
type N = ("name", "age")
type Names = Tuple.Map[N, [X] =>> X]
val x = new SelectableNT[Names]
x.name
object ExhibitE: // works
type N = ("name", "age")
type Names = Tuple.Map[N, [X] =>> X]
class SelectableNT extends Selectable:
def selectDynamic(name: String) = ???
type Fields = NamedTuple.NamedTuple[Names, (String, Int)]
val x = new SelectableNT
x.nameOutput
[error] .\bug.scala:15:3
[error] value name is not a member of bug.ExhibitA.SelectableNT[(("name" : String), ("age" : String))]
[error] x.name // fails
[error] ^^^^^^Expectation
Successful compilation
Metadata
Metadata
Assignees
Labels
area:named-tuplesIssues tied to the named tuples feature.Issues tied to the named tuples feature.itype:bug