Skip to content

Commit e8b07a3

Browse files
committed
Better diagnosis from completions printer
Track starts and ends of completions using indentation.
1 parent 9fe9865 commit e8b07a3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/dotty/tools/dotc/config/Printers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ object Printers {
2222
val implicitsDetailed: Printer = noPrinter
2323
val subtyping: Printer = noPrinter
2424
val unapp: Printer = noPrinter
25-
val completions = noPrinter
2625
val gadts = noPrinter
2726
val hk = noPrinter
2827
val variances = noPrinter
2928
val incremental = noPrinter
3029
val config = noPrinter
3130
val transforms = noPrinter
31+
val completions = noPrinter
3232
val cyclicErrors = noPrinter
3333
val pickling = noPrinter
3434
}

src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,11 @@ object SymDenotations {
163163
}
164164

165165
private def completeFrom(completer: LazyType)(implicit ctx: Context): Unit = {
166+
if (completions ne noPrinter) {
167+
completions.println(i"${" " * indent}completing ${if (isType) "type" else "val"} $name")
168+
indent += 1
169+
}
170+
indent += 1
166171
if (myFlags is Touched) throw CyclicReference(this)
167172
myFlags |= Touched
168173

@@ -173,6 +178,11 @@ object SymDenotations {
173178
completions.println(s"error while completing ${this.debugString}")
174179
throw ex
175180
}
181+
finally
182+
if (completions ne noPrinter) {
183+
indent -= 1
184+
completions.println(i"${" " * indent}completed $name in $owner")
185+
}
176186
// completions.println(s"completed ${this.debugString}")
177187
}
178188

@@ -1872,4 +1882,6 @@ object SymDenotations {
18721882
}
18731883

18741884
private val AccessorOrLabel = Accessor | Label
1885+
1886+
private var indent = 0 // for completions printing
18751887
}

0 commit comments

Comments
 (0)