Skip to content

Commit 9959ff7

Browse files
committed
Update trace format for consistency
1 parent 7393a9b commit 9959ff7

File tree

2 files changed

+8
-7
lines changed
  • compiler/src/dotty/tools/dotc/transform/init
  • tests/init-global/special/tastySource

2 files changed

+8
-7
lines changed

compiler/src/dotty/tools/dotc/transform/init/Trace.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@ object Trace:
6161
val line =
6262
if pos.exists then
6363
val loc = pos.source.file.name + ":" + (pos.line + 1)
64-
if hasSource then
65-
val code = SyntaxHighlighting.highlight(pos.lineContent.trim)
66-
i"$code\t[ $loc ]"
67-
else
68-
loc
64+
val code =
65+
if hasSource then
66+
SyntaxHighlighting.highlight(pos.lineContent.trim)
67+
else
68+
"(no source)"
6969

70+
i"$code\t[ $loc ]"
7071
else
7172
tree match
7273
case defDef: DefTree =>

tests/init-global/special/tastySource/B.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
|Reading mutable state of other static objects is forbidden as it breaks initialization-time irrelevance. Calling trace:
66
|├── object B: [ B.scala:1 ]
77
|│ ^
8-
|├── A.scala:2
9-
|├── A.scala:4
8+
|├── (no source) [ A.scala:2 ]
9+
|├── (no source) [ A.scala:4 ]
1010
|├── var y = A.foo(bar) * 2 [ B.scala:2 ]
1111
|│ ^^^
1212
|└── def bar = C.n * 3 // warn [ B.scala:4 ]

0 commit comments

Comments
 (0)