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

Inferred type in infer method code action should infer generics correctly #6954

Closed
tgodzik opened this issue Nov 21, 2024 · 3 comments · Fixed by #7158
Closed

Inferred type in infer method code action should infer generics correctly #6954

tgodzik opened this issue Nov 21, 2024 · 3 comments · Fixed by #7158
Labels
bug Something that is making a piece of functionality unusable code action Related to LSP code actions spree

Comments

@tgodzik
Copy link
Contributor

tgodzik commented Nov 21, 2024

Describe the bug

trait Main {
  def main() = {
    val list = List((1, 2, 3))
    // def otherMethod(arg0: (T1, T2, T3)) = ??? <- this will be inferred
    list.map(otherMethod)
  }
}

Expected behavior

trait Main {
  def main() = {
    val list = List((1, 2, 3))
    def otherMethod(arg0: (Int, Int, Int)) = ???
    list.map(otherMethod)
  }
}

Operating system

None

Editor/Extension

VS Code

Version of Metals

1.4.2-SNAPSHOT

Extra context or search terms

Follow up from #6877

@tgodzik
Copy link
Contributor Author

tgodzik commented Nov 21, 2024

Another case to tackle is:

object O{
  val ig = new IGO {}
  ig.news
}

trait IGO

EDIT: fixed

@tgodzik
Copy link
Contributor Author

tgodzik commented Nov 21, 2024

And another:

trait Main {
    def method1(b: Double, s : String) = 123

    case class User(i : Int)

    def otherMethod(arg0: Any, arg1: Int) = ???
    otherMethod(User(1), 1)
}

@tgodzik tgodzik added bug Something that is making a piece of functionality unusable code action Related to LSP code actions labels Nov 22, 2024
@tgodzik
Copy link
Contributor Author

tgodzik commented Nov 22, 2024

Another case to tackle is:

object O{
  val ig = new IGO {}
  ig.news
}

trait IGO

This one is fixed

@kasiaMarek kasiaMarek changed the title Inferred type should infer generics correctly Inferred type in infer method code action should infer generics correctly Jan 18, 2025
tgodzik added a commit to tgodzik/metals that referenced this issue Jan 25, 2025
tgodzik added a commit to tgodzik/metals that referenced this issue Jan 25, 2025
tgodzik added a commit to tgodzik/metals that referenced this issue Jan 25, 2025
tgodzik added a commit to tgodzik/metals that referenced this issue Jan 27, 2025
tgodzik added a commit that referenced this issue Jan 29, 2025
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 code action Related to LSP code actions spree
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants