scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.08k stars 330 forks source link

Incosistent in showing inferred type parameters for type parameters #4474

Open kpodsiad opened 2 years ago

kpodsiad commented 2 years ago

Given following snippet (scala version will change later)

//> using scala "2.13.8"

object Main extends App {
  class Wrapper[A](val value: A)
  def wrap[A](value: A): Wrapper[A] = new Wrapper(value)

  val x = new Wrapper(5)
  val x2 = wrap(5)
}

for Scala 2.13.8 Metals don't show inferred type of type parameter A which is Int

Screenshot 2022-10-03 at 12 47 32

whereas for 3.2.0 inferred type is showed.

Screenshot 2022-10-03 at 12 47 17

Expectation: Metals show inferred type in both scala versions.

kpodsiad commented 2 years ago

I'd like to fix this one, could you guide me a bit what do I need to do? I'm guessing this needs fix in https://github.com/scalameta/scalameta/tree/main/semanticdb? cc: @tanishiking

tanishiking commented 2 years ago

@kpodsiad Great! yes, that's true, it should be stored in synthetics, I guess we should look into around here https://github.com/scalameta/scalameta/blob/ab3bf7de916f87538171a851791c1b9f950208c8/semanticdb/scalac/library/src/main/scala/scala/meta/internal/semanticdb/scalac/TextDocumentOps.scala#L602-L608

kpodsiad commented 2 years ago

@tanishiking could you give a few tips how to test/debug semanticDB scalac plugin? Anything better than save-expect?

tgodzik commented 1 year ago

@tanishiking could you give a few tips how to test/debug semanticDB scalac plugin? Anything better than save-expect?

There is the TargetedSuite that is useful for debugging since it can work on arbitrary block of code.