-
Notifications
You must be signed in to change notification settings - Fork 330
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
bugfix: don't show inferred type for val def bind #5891
Conversation
c8cb490
to
7ac55b5
Compare
7ac55b5
to
32323c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, we don't have to use vd.source.content()
but this is fine
* val <<t>> @ ... = | ||
*/ | ||
private def isValDefBind(vd: ValDef)(using Context) = | ||
val (_, afterDef) = vd.source.content().splitAt(vd.nameSpan.end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val (_, afterDef) = vd.source.content().splitAt(vd.nameSpan.end) | |
val afterDef = text.drop(vd.namePosition.end) |
* val <<t>> @ ... = | ||
*/ | ||
private def isValDefBind(vd: ValDef) = { | ||
val (_, afterDef) = vd.pos.source.content.splitAt(vd.namePosition.end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can move it to PcSyntheticDecorationsProvider
so we can use text
instead of pos.source.content
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to move it for Scala 3, I'd have to pattern match to see it's a ValDef, and it's a bit inconsistent. I added a given for Scala 3 instead (with an opaque type). What do you think? Too much hassle?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine
Backports changes from - scalameta/metals#5891 - scalameta/metals#5982
resolves: #5835
There seems to be no reasonable way to distinguish
t
fromt1
inval t @ (t1, t2,) = (1,2)
in typed trees. We could do this on untyped but I think it will be faster this way.