You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can also write anonymous given, and the compiler will synthesize the variable name by combining given_ and it's type name.
givenInt=1// syntheticgivengiven_Int:Int=1
I believe it would be helpful to extract compiler-generated trees that represent "missing identifier" (synthesized anonymous using params and invented given) to Synthetics because if there's not the given instance application synthetics in Scala3 (introduced by scala/scala3#13288) won't have complete information.
For example, when programmers write a code using an anonymous using param, there will be a synthetic tree (in SemanticDB) that represents an application whose argument is x$2, which is synthesized name by the compiler.
If there's no information where x$2 is defined, we can't understand where x$2 comes from. And that's why I think adding "missing identifier" information to Synthetic is useful.
Problem
So, the simplest way to represent missing identifier is by wrapping the symbol by Idtree like
We can't tell the symbol wrapped by IdTree is a definition or reference. Obviously, it's a definition in this case, but it will be a problem when other synthetics are introduced and there's a pattern that is represented by Idtree(symbol).
I think its unclear how to process the tree because usually a synthetic has a clear "hole" representing source code which the synthetic wraps, in this case though, the source code contains a hole and the IdTree is the plug - this is an inversion of the current mental model
The discussion originally from scala/scala3#13288
Background
In Scala3, we can write anonymous using params
using <TypeName>
, and the compiler synthesizes the variable name likex$1
for it.We can also write anonymous
given
, and the compiler will synthesize the variable name by combininggiven_
and it's type name.I believe it would be helpful to extract compiler-generated trees that represent "missing identifier" (synthesized anonymous using params and invented given) to Synthetics because if there's not the given instance application synthetics in Scala3 (introduced by scala/scala3#13288) won't have complete information.
For example, when programmers write a code using an anonymous using param, there will be a synthetic tree (in SemanticDB) that represents an application whose argument is
x$2
, which is synthesized name by the compiler.If there's no information where
x$2
is defined, we can't understand wherex$2
comes from. And that's why I think adding "missing identifier" information to Synthetic is useful.Problem
So, the simplest way to represent missing identifier is by wrapping the symbol by
Idtree
likescala/scala3@aef23bc
The problem is
IdTree
is a definition or reference. Obviously, it's a definition in this case, but it will be a problem when other synthetics are introduced and there's a pattern that is represented byIdtree(symbol)
.Options
Idtree(symbol)
IdTree
with a new tree kind something likeValDef
? so we can tell it is a definition.The text was updated successfully, but these errors were encountered: