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

Incorrect overload chosen in navigation to extension method #6558

Closed
reynaldjoabet opened this issue Jul 1, 2024 · 2 comments
Closed

Incorrect overload chosen in navigation to extension method #6558

reynaldjoabet opened this issue Jul 1, 2024 · 2 comments
Assignees
Labels
bug Something that is making a piece of functionality unusable fixed-upstream Tag a ticket with this when a fix upstream has been completed and we can now address the ticket navigation Related to goto definition, find references, open symbol Scala 3 Generic ticket relating to Scala 3
Milestone

Comments

@reynaldjoabet
Copy link

Describe the bug

import org.typelevel.twiddles.syntax.*
List(7)*:List(2)

When you click on *:, you get the wrong extension method(cons)

   extension [F[_], A](fa: F[A])
    @annotation.targetName("cons")
    def *:[G[x] >: F[x], B <: Tuple](gb: G[B])(using InvariantSemigroupal[G]): G[A *: B] =
      fa.product(gb).imap[A *: B] { case (hd, tl) => hd *: tl } { case hd *: tl => (hd, tl) }

    @annotation.targetName("pair")
    @annotation.nowarn
    def *:[G[x] >: F[x], B](gb: G[B])(using InvariantSemigroupal[G]): G[A *: B *: EmptyTuple] =
      fa.product(gb).imap[A *: B *: EmptyTuple] { case (a, b) => a *: b *: EmptyTuple } {
        case a *: b *: EmptyTuple => (a, b)
      }

Expected behavior

  @annotation.targetName("pair")
    @annotation.nowarn
    def *:[G[x] >: F[x], B](gb: G[B])(using InvariantSemigroupal[G]): G[A *: B *: EmptyTuple] =
      fa.product(gb).imap[A *: B *: EmptyTuple] { case (a, b) => a *: b *: EmptyTuple } {
        case a *: b *: EmptyTuple => (a, b)
      }

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

v1.3.2

Extra context or search terms

No response

@tgodzik
Copy link
Contributor

tgodzik commented Jul 2, 2024

Thanks for reporting! Looks like we don't handle things with targetName correctly 🤔

@tgodzik tgodzik added navigation Related to goto definition, find references, open symbol Scala 3 Generic ticket relating to Scala 3 bug Something that is making a piece of functionality unusable labels Jul 2, 2024
@kasiaMarek kasiaMarek moved this from Triage to In progress in Metals Issue Board Jul 2, 2024
@kasiaMarek kasiaMarek self-assigned this Jul 9, 2024
@kasiaMarek kasiaMarek added the fixed-upstream Tag a ticket with this when a fix upstream has been completed and we can now address the ticket label Jul 10, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in Metals Issue Board Jul 10, 2024
@kasiaMarek
Copy link
Contributor

Fixed in compiler in: scala/scala3#20950.

@tgodzik tgodzik added this to the Metals v1.3.3 milestone Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is making a piece of functionality unusable fixed-upstream Tag a ticket with this when a fix upstream has been completed and we can now address the ticket navigation Related to goto definition, find references, open symbol Scala 3 Generic ticket relating to Scala 3
Projects
Archived in project
Development

No branches or pull requests

3 participants