File tree 3 files changed +32
-2
lines changed
compiler/src/dotty/tools/dotc
presentation-compiler/test/dotty/tools/pc/tests/highlight
3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -461,8 +461,11 @@ object Trees {
461
461
else if qualifier.span.exists && qualifier.span.start > span.point then // right associative
462
462
val realName = name.stripModuleClassSuffix.lastPart
463
463
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)
466
469
else span
467
470
}
468
471
Original file line number Diff line number Diff line change @@ -59,6 +59,9 @@ object Spans {
59
59
if (poff == SyntheticPointDelta ) start else start + poff
60
60
}
61
61
62
+ def pointMayBeIncorrect =
63
+ pointDelta == 0 && end - start >= SyntheticPointDelta
64
+
62
65
/** The difference between point and start in this span */
63
66
def pointDelta : Int =
64
67
(coords >>> (StartEndBits * 2 )).toInt
Original file line number Diff line number Diff line change @@ -1462,5 +1462,29 @@ class DocumentHighlightSuite extends BaseDocumentHighlightSuite:
1462
1462
|""" .stripMargin
1463
1463
)
1464
1464
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
+
1465
1489
1466
1490
end DocumentHighlightSuite
You can’t perform that action at this time.
0 commit comments