scalafix icon indicating copy to clipboard operation
scalafix copied to clipboard

Improve semantic information for types compiled by dotty

Open bjaglin opened this issue 1 year ago • 3 comments
trafficstars

The SymbolTable required by core for finding information that is not available in SemanticDB is injected by cli using a helper from reflect, which is currently backed by scalameta's internal semanticdb-scalac-core which was written for Scala 2 class files.

https://github.com/scalacenter/scalafix/blob/c6d741174abf76c01862a2aac1b52379b106c5d9/scalafix-core/src/main/scala/scalafix/internal/v1/InternalSemanticDoc.scala#L68-L82

https://github.com/scalacenter/scalafix/blob/c6d741174abf76c01862a2aac1b52379b106c5d9/scalafix-cli/src/main/scala/scalafix/internal/v1/Args.scala#L200-L212

https://github.com/scalacenter/scalafix/blob/c6d741174abf76c01862a2aac1b52379b106c5d9/scalafix-reflect/src/main/scala/scalafix/internal/reflect/ClasspathOps.scala#L27-L33

We need to migrate to https://github.com/scalacenter/tasty-query or equivalent to provide exhaustive information about types compiled by dotty. While doing that, we should drop the need to using Scalameta internal structures as a contract between core & cli.

bjaglin avatar Aug 24 '24 23:08 bjaglin

An alternative is to use info method that we added to the presentation compiler. It provides a similar interface as semanticdb.

tgodzik avatar Aug 25 '24 20:08 tgodzik

Interesting! Do you know what's the PC overhead? In terms of start up time (I guess in Metals it's warm no it does not matter much) and RAM footprint?

bjaglin avatar Aug 25 '24 21:08 bjaglin

The overhead shouldn't be too big, but it's hard to say. It's basically the addition of the compiler, which would already be added when I manage to finish the inferred type PR.

tgodzik avatar Aug 26 '24 09:08 tgodzik