Open tanishiking opened 3 years ago
My 3 cents about the priorities in the task. I added a number for each one, but these are completely subjective and arbitrary.
Using parameter application
10
For sure that would be one of the top ones, we should also include anonymous ones, but there should be a difference in how they are represented, maybe we don't need a separate synthetic for the name then.
Implicit parameters
10
Same importance as the using parameters.
Macro Expansion
9
This would be very useful when debugging macros, but I am not sure how doable it is currently.
Inferred Type Application
7
It's pretty useful to show to users and an easy way to see what type was inferred for a particular function.
Extension method application?
6
For sure this would be useful, the same as Scala 2 implicit classes, but not the most important.
implicit conversion
6
Would be pretty good to have, but might be different thatn Scala 3 in terms of representation. We would need to take into account https://docs.scala-lang.org/scala3/reference/contextual/conversions.html
Inferred method application
5
This might be useful, especially if some has a rewrite in Scalafix, I imagine we could also show it in Metals.
For loop desugaring
2
This is not currently used anywhere and it's actually simple to translate for comprehensions manually even.
Thank you for the comment! I'll start working on using parameters and anonymous context params (and maybe apply implicit parameters) first :)
For context / implicit params, anonymous context params, and anonymous given: opened a PR https://github.com/tanishiking/dotty/pull/2 which depends on https://github.com/lampepfl/dotty/pull/12885 I'll submit a PR to dotty/dotty
once https://github.com/lampepfl/dotty/pull/12885 has merged (couldn't open the PR to dotty/dotty
because the original branch is in tanishiking/dotty
)
TypeApplication part is almost ready https://github.com/tanishiking/dotty/pull/5 and I'll submit a PR to lampepfl/dotty once the base branch has merged into master
https://scalameta.org/docs/semanticdb/specification.html#synthetic
One of the main consumers of
Synthetics
information of SemanticDB is decraotion feature of metals, and once Scala3 extract these information, those features are available for Scala3 in Metals.TODO
If there's something we should add to Synthetic section, please let me know :)
Using parameter application
what should we do for anonymous context params?
should we add
x$1
to synthetics?Anonymous context params
Extension method application?
Wondering how should we design the Synthetics Tree for the extension method...
Maybe we don't need to extract synthetics for the extension method at this moment, because the main consumer of the synthetics section of SemancticDB is metals's Decoration feature. While extracting Implicit conversion for Scala2 is important for implicit decoration's readability, showing
plus(1)(3)
for the extension method doesn't help developers to read those programs.Scala2 compatible synthetics
Inferred method application
, TypeApplyTree( SelectTree( OriginalTree(
), Some(IdTree())),
List(TypeRef(None, , List()))
)
)
Synthetic(
, TypeApplyTree( SelectTree( OriginalTree(
), Some(IdTree())),
List(TypeRef(None, , List()))
)
)
```
Inferred Type Application
, TypeApplyTree( SelectTree( OriginalTree(
), Some(IdTree())),
List(TypeRef(None, , List()))
)
)
Synthetic(
, TypeApplyTree( OriginalTree(
), List( TypeRef(None,, List()),
TypeRef(None,
, List(TypeRef(None,, List()))))
)
)
Synthetic(
<#:: 2 #:: Stream.empty>,
TypeApplyTree(
OriginalTree(<#:: 2 #:: Stream.empty>),
List(
TypeRef(None, , List())))
)
```
Implicit parameters
implicit conversion
Macro Expansion
For loop desugaring