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

Named Tuple selections have no hover #20500

Closed
bishabosha opened this issue May 30, 2024 · 0 comments · Fixed by #22202
Closed

Named Tuple selections have no hover #20500

bishabosha opened this issue May 30, 2024 · 0 comments · Fixed by #22202
Assignees
Labels
area:named-tuples Issues tied to the named tuples feature. area:presentation-compiler Related to the presentation compiler module used by Metals and possibly other tools itype:bug

Comments

@bishabosha
Copy link
Member

bishabosha commented May 30, 2024

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.

@bishabosha bishabosha added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label area:presentation-compiler Related to the presentation compiler module used by Metals and possibly other tools area:named-tuples Issues tied to the named tuples feature. and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels May 30, 2024
bracevac pushed a commit to dotty-staging/dotty that referenced this issue Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:named-tuples Issues tied to the named tuples feature. area:presentation-compiler Related to the presentation compiler module used by Metals and possibly other tools itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants