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

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

Open
kavedaa opened this issue Nov 24, 2024 · 0 comments
Labels
itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label

Comments

@kavedaa
Copy link

kavedaa commented Nov 24, 2024

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

@kavedaa kavedaa added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label
Projects
None yet
Development

No branches or pull requests

1 participant