Skip to content

Commit ce6a018

Browse files
committed
exclude xrayhints for synthetics
1 parent 68396ca commit ce6a018

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

presentation-compiler/src/main/dotty/tools/pc/PcInlayHintsProvider.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -526,17 +526,17 @@ object XRayModeHint:
526526
anotherTree
527527
.innerSelect()
528528
*/
529-
case a @ Apply(inner, _)
530-
if inner.sourcePos.exists && !isParentOnSameLine && !isParentApply &&
531-
endsInSimpleSelect(a) && isEndOfLine(tree.sourcePos) =>
532-
Some((a.tpe.widen.deepDealiasAndSimplify, tree.sourcePos))
529+
case apply @ Apply(inner, _)
530+
if !apply.span.isZeroExtent && inner.sourcePos.exists && !isParentOnSameLine &&
531+
!isParentApply && endsInSimpleSelect(apply) && isEndOfLine(tree.sourcePos) =>
532+
Some((apply.tpe.widen.deepDealiasAndSimplify, tree.sourcePos))
533533
/*
534534
innerTree
535535
.select
536536
*/
537537
case select @ Select(innerTree, _)
538-
if innerTree.sourcePos.exists && !isParentOnSameLine && !isParentApply &&
539-
isEndOfLine(tree.sourcePos) =>
538+
if !select.span.isZeroExtent && innerTree.sourcePos.exists &&
539+
!isParentOnSameLine && !isParentApply && isEndOfLine(tree.sourcePos) =>
540540
Some((select.tpe.widen.deepDealiasAndSimplify, tree.sourcePos))
541541
case _ => None
542542
else None

presentation-compiler/test/dotty/tools/pc/tests/inlayHints/InlayHintsSuite.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,4 +1668,23 @@ class InlayHintsSuite extends BaseInlayHintsSuite {
16681668
|""".stripMargin
16691669
)
16701670

1671+
@Test def `xray-metals-i7999` =
1672+
check(
1673+
"""|object Main{
1674+
| case class User(
1675+
| name: String = {
1676+
| Map.toString
1677+
| }
1678+
| )
1679+
|}
1680+
|""".stripMargin,
1681+
"""|object Main{
1682+
| case class User(
1683+
| name: String = {
1684+
| Map.toString
1685+
| }
1686+
| )
1687+
|}
1688+
|""".stripMargin
1689+
)
16711690
}

0 commit comments

Comments
 (0)