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

"Any" inferred for complex type #5755

Closed
kubukoz opened this issue Oct 16, 2023 · 1 comment
Closed

"Any" inferred for complex type #5755

kubukoz opened this issue Oct 16, 2023 · 1 comment
Labels
completions Tickets related to completion functionality hover Scala 2
Milestone

Comments

@kubukoz
Copy link
Contributor

kubukoz commented Oct 16, 2023

Describe the bug

For some complex types, particularly those you see when using client/server builders in smithy4s, Metals may struggle to infer a useful type.

To reproduce:

  1. Clone https://github.com/kubukoz/demos/tree/metals-issue-smithy4s-type-inference
  2. Import into metals
  3. Update Demo.scala:
package hello

import smithy4s.http4s.SimpleRestJsonBuilder
import org.http4s.client.Client
import cats.effect.IO
import hello.WeatherService

object Demo {
  val b =
    SimpleRestJsonBuilder(WeatherService).client(??? : Client[IO])

  b@@
}
  1. Put the cursor on @@
  2. Trigger completions
  3. b shows up as Any
image

(on this screenshot, ignore the grey suggestion, it's from github copilot)

Expected behavior

The inferred type should be smithy4s.http4s.SimpleRestJsonBuilder.ClientBuilder[hello.WeatherServiceGen, cats.effect.IO]

Operating system

macOS

Editor/Extension

VS Code

Version of Metals

v1.0.1

Extra context or search terms

You can also see the inferred type show up as Any if you try to insert the inferred type of val b.

@tgodzik
Copy link
Contributor

tgodzik commented Oct 23, 2023

Closed by #5763

@tgodzik tgodzik closed this as completed Oct 23, 2023
@tgodzik tgodzik added this to the Metals v1.1.1 milestone Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completions Tickets related to completion functionality hover Scala 2
Projects
None yet
Development

No branches or pull requests

2 participants