scala/scala3

Named Tuple selections have no hover

Opened this issue · 0 comments

Compiler version

3.5.0-RC1

Minimized code

import scala.language.experimental.namedTuples

import NamedTuple.*

val foo = (name = "Bob", age = 42)

val foo_name = foo.name
//                 ^^^^ hover here

class NamedTupleSelectable extends Selectable {
  type Fields <: AnyNamedTuple
  def selectDynamic(name: String): Any = ???
}

val person = new NamedTupleSelectable {
  type Fields = (name: String, city: String)
}

val person_name = person.name
//                       ^^^^ hover here

Output

  • for the named tuple, the hover shows NamedTuple.apply, which is what the .name selection desugars to.
  • for the Fields selection, it shows nothing

Expectation

I'd expect to see name: String when hovering.

I think we can do better here, for example, structural selections on Selectable show the structural signature, and not selectDynamic.