Skip to content

Commit

Permalink
improvement: Do not show positions for synthetic params
Browse files Browse the repository at this point in the history
  • Loading branch information
tgodzik committed Nov 16, 2024
1 parent 0f98725 commit 162f30c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ final class PcInlayHintsProvider(
}

private def labelPart(symbol: Symbol, label: String) =
if (symbol.pos.source == pos.source) {
if (symbol.isSynthetic && !symbol.isMethod) {
LabelPart(label)
} else if (symbol.pos.source == pos.source) {
val pos = if (symbol.pos.start != symbol.pos.point) {
symbol.pos.withStart(symbol.pos.point)
} else {
Expand Down
4 changes: 2 additions & 2 deletions tests/cross/src/test/scala/tests/pc/InlayHintsSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
|""".stripMargin,
"""|object Main{
| implicit def stringLength(s: String): Int = s.length
| implicitly[String => Int]/*((s: String<<java/lang/String#>>) => stringLength<<(2:15)>>(s<<(3:12)>>)))*/
| implicitly[String => Int]/*((s: String<<java/lang/String#>>) => stringLength<<(2:15)>>(s)))*/
|
| implicit val namedStringLength: String => Long = (s: String) => s.length.toLong
| implicitly[String => Long]/*(namedStringLength<<(5:15)>>)*/
Expand All @@ -1013,7 +1013,7 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
|""".stripMargin,
"""|object Main{
| implicit def stringLength(s: String, i: Int): Int = s.length
| implicitly[(String, Int) => Int]/*((s: String<<java/lang/String#>>, i: Int<<scala/Int#>>) => stringLength<<(2:15)>>(s<<(3:12)>>, i<<(3:12)>>)))*/
| implicitly[(String, Int) => Int]/*((s: String<<java/lang/String#>>, i: Int<<scala/Int#>>) => stringLength<<(2:15)>>(s, i)))*/
|}
|""".stripMargin,
compat = Map(
Expand Down

0 comments on commit 162f30c

Please sign in to comment.