Skip to content

Commit 2f295c4

Browse files
committed
Fix printer bug
The recovery after a `summarized` was wrong, which meant that after a first print summarized we'd always print in summarized mode, writing lots of "...".
1 parent c77fdcc commit 2f295c4

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
547547
val saved = maxSummarized
548548
maxSummarized = ctx.base.toTextRecursions + depth
549549
try op
550-
finally maxSummarized = depth
550+
finally maxSummarized = saved
551551
}
552552

553553
def summarized[T](op: => T): T = summarized(summarizeDepth)(op)

tests/run/typeclass-derivation2d.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ object Deriving {
1919
type MirrorOf[T] = Mirror { type MonoType = T }
2020
type ProductMirrorOf[T] = Mirror.Product { type MonoType = T }
2121
type SumMirrorOf[T] = Mirror.Sum { type MonoType = T }
22-
type SingletonMirror = Mirror.Singleton
2322

2423
object Mirror {
2524

@@ -369,7 +368,7 @@ object Show {
369368
inline def showCase(x: Any, m: ProductMirrorOf[_]): String = {
370369
val label = constValue[m.CaseLabel]
371370
inline m match {
372-
case m: SingletonMirror => label
371+
case m: Mirror.Singleton => label
373372
case _ => showElems[m.ElemTypes, m.ElemLabels](0)(x).mkString(s"$label(", ", ", ")")
374373
}
375374
}

0 commit comments

Comments
 (0)