File tree 3 files changed +23
-1
lines changed
compiler/src/dotty/tools/dotc/transform/init
3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ object Trace:
77
77
* pos.source must exist
78
78
*/
79
79
private def positionMarker (pos : SourcePosition ): String =
80
- val trimmed = pos.lineContent.takeWhile(c => c.isWhitespace).length
80
+ val trimmed = pos.source. lineContent(pos.start) .takeWhile(c => c.isWhitespace).length
81
81
val padding = pos.startColumnPadding.substring(trimmed).nn + " "
82
82
val carets =
83
83
if (pos.startLine == pos.endLine)
Original file line number Diff line number Diff line change
1
+ -- Error: tests/init-global/neg/line-spacing.scala:4:7 -----------------------------------------------------------------
2
+ 3 | B
3
+ 4 | .s.length // error
4
+ | ^
5
+ | Access uninitialized field value s. Call trace:
6
+ | -> object B { [ line-spacing.scala:7 ]
7
+ | ^
8
+ | -> val s: String = s"${A.a}a" [ line-spacing.scala:8 ]
9
+ | ^^^
10
+ | -> def a: Int = [ line-spacing.scala:2 ]
11
+ | ^
12
+ | -> .s.length // error [ line-spacing.scala:4 ]
13
+ | ^
Original file line number Diff line number Diff line change
1
+ object A {
2
+ def a : Int =
3
+ B
4
+ .s.length // error
5
+ }
6
+
7
+ object B {
8
+ val s : String = s " ${A .a}a "
9
+ }
You can’t perform that action at this time.
0 commit comments