File tree Expand file tree Collapse file tree 3 files changed +32
-2
lines changed
compiler/src/dotty/tools/dotc
presentation-compiler/test/dotty/tools/pc/tests/highlight Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -461,8 +461,11 @@ object Trees {
461461 else if qualifier.span.exists && qualifier.span.start > span.point then // right associative
462462 val realName = name.stripModuleClassSuffix.lastPart
463463 Span (span.start, span.start + realName.length, point)
464- else
465- Span (point, span.end, point)
464+ else if span.pointMayBeIncorrect then
465+ val realName = name.stripModuleClassSuffix.lastPart
466+ val probablyPoint = span.end - realName.length
467+ Span (probablyPoint, span.end, probablyPoint)
468+ else Span (point, span.end, point)
466469 else span
467470 }
468471
Original file line number Diff line number Diff line change @@ -59,6 +59,9 @@ object Spans {
5959 if (poff == SyntheticPointDelta ) start else start + poff
6060 }
6161
62+ def pointMayBeIncorrect =
63+ pointDelta == 0 && end - start >= SyntheticPointDelta
64+
6265 /** The difference between point and start in this span */
6366 def pointDelta : Int =
6467 (coords >>> (StartEndBits * 2 )).toInt
Original file line number Diff line number Diff line change @@ -1462,5 +1462,29 @@ class DocumentHighlightSuite extends BaseDocumentHighlightSuite:
14621462 |""" .stripMargin
14631463 )
14641464
1465+ @ Test def i3053 =
1466+ check(
1467+ s """ import Aaaa.*
1468+ |
1469+ |def classDef2(cdef: List[Int]): Int = {
1470+ | def aaa(ddef: Thicket2): List[Int] = ddef match {
1471+ | case Thicket2(_) => ???
1472+ | }
1473+ | ${(" //" + " x" * 64 + " \n " ) * 64 }
1474+ | 1
1475+ |}.<<showing2>>("aaa")
1476+ |
1477+ |case class Thicket2(trees: List[Int]) {}
1478+ |
1479+ |object Aaaa {
1480+ | extension [T](x: T)
1481+ | def <<show@@ing2>>[U](aaa: String): T = {
1482+ | x
1483+ | }
1484+ |}
1485+ |
1486+ | """ .stripMargin
1487+ )
1488+
14651489
14661490end DocumentHighlightSuite
You can’t perform that action at this time.
0 commit comments