Skip to content

Named Tuple selections have no hover #20500

Closed
@bishabosha

Description

@bishabosha

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.

Metadata

Metadata

Assignees

Labels

area:named-tuplesIssues tied to the named tuples feature.area:presentation-compilerRelated to the presentation compiler module used by Metals and possibly other toolsitype:bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions