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
Improve the Synthetic's tree so it can represent the context param application (with using
)
#2460
Comments
I personally think this issue is not so highly prioritized because of the |
Thanks for raising this! Do we know if Scala 3 will drop implicit parameters completely at some point? In that case synthetic ApplyTree cannot really apply to implicits in the future just using. We could add |
can you add a flags field to ApplyTree? so generalised for future application kinds? |
Historically, we don't add boolean flags to trees, but instead add a separate tree node. I think we should be consistent in that regards. |
👍 to message ApplyUsingTree {
Tree function = 1;
repeated Tree arguments = 2;
} Since scalameta parses the following code to the scalameta AST below. def f(using TC, Int) = ???
f(using tc, 1)
Term.ApplyUsing(Term.Name("f"), List(Term.Name("tc"), Lit.Int(1))) |
See the original discussion: scala/scala3#13288 (comment)
Background
Scala3's SemanticDB extractor extracts context params application as
Synthetic
. scala/scala3#13288For example
Potential problem
x
is an implicit parameter or context params.import Foo.given Int
and there's no SymbolInformation forx
is available from theTextDocument
.x
is defined in the sameTextDocument
(e.g.def m(using x: Int) = foo(0)
), we can lookup the SymbolInformation and see it's properties.metals
'sshow implicit arguments
feature will showfoo(0)(x)
which doesn't compile, instead offoo(0)(using x)
.So the discussion is
Should Synthetic have complete information to re-construct the original program from the tree?
Counter argument
It might not a big problem for tooling.
metals
'sshow implicit arguments
feature ends up showingfoo(0)(x)
which is uncompilable decoration, the decorations are never compiled.Potential solution
ApplyTree
so we can tell it is a context-param or implicit param.SymbolInformation
for the context-param argument.SymbolInformation
, but I think it works well.IdTree
?The text was updated successfully, but these errors were encountered: