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
I'm looking at a completion issue in the IDE that is due to a Tree having a transparent position, when an opaque one is expected.
I'll use the following code for describing the issue:
objectA {
defapply(a: Int) = a
A(
}
Notice the missing closing parens, so there is a syntax error. Nonetheless, if you explicitly type A.apply(, completion works as expected (hence,
I expect this should work similarly when the synthetic apply is injected by scalac).
I had a look at the tree, and my belief is that the positions assigned when expanding A(null) (this is the Tree after parser) into A.apply(null)
(this is the tree I see in typer, while debugging) are incorrect, because the qualifier A in the latter Tree ( A.apply(null)) has a transparent position,
instead of an opaque one. The fact that the qualifier has a transparent position messes up completion, as we need to retrieve the qualifier to look at its members.
Jason correctly suggested to look into insertApply in Typers, and specifically this expression:
@dotta said:
Indeed, if not even later - not sure when and if I'll have time to work on this. The PR I linked should be a very good starting point for anyone willing to have a look at this.
I'm looking at a completion issue in the IDE that is due to a Tree having a transparent position, when an opaque one is expected.
I'll use the following code for describing the issue:
Notice the missing closing parens, so there is a syntax error. Nonetheless, if you explicitly type
A.apply(
, completion works as expected (hence,I expect this should work similarly when the synthetic
apply
is injected by scalac).I had a look at the tree, and my belief is that the positions assigned when expanding
A(null)
(this is the Tree after parser) intoA.apply(null)
(this is the tree I see in typer, while debugging) are incorrect, because the qualifier A in the latter Tree (
A.apply(null)
) has a transparent position,instead of an opaque one. The fact that the qualifier has a transparent position messes up completion, as we need to retrieve the qualifier to look at its members.
Jason correctly suggested to look into
insertApply
inTypers
, and specifically this expression:typedPos(tree.pos, mode, pt) { Select(qual setPos tree.pos.makeTransparent, nme.apply) }
Indeed, changing the above into
typedPos(tree.pos.makeTransparent, mode, pt) { Select(qual setPos tree.pos, nme.apply) }
fixes the issue. Will issue a PR soon.
The text was updated successfully, but these errors were encountered: