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

Open
bishabosha opened this issue May 30, 2024 · 0 comments · May be fixed by #22202
Open

Named Tuple selections have no hover #20500

bishabosha opened this issue May 30, 2024 · 0 comments · May be 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
@kasiaMarek kasiaMarek linked a pull request Dec 12, 2024 that will close this issue
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