Skip to content

Commit 1094cbe

Browse files
committed
Keep debugBoundsDescription to view the underlying constraint
1 parent 7973062 commit 1094cbe

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

compiler/src/dotty/tools/dotc/core/GadtConstraint.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ sealed abstract class GadtConstraint extends Showable {
5555

5656
/** Restore the state from other [[GadtConstraint]], probably copied using [[fresh]] */
5757
def restore(other: GadtConstraint): Unit
58+
59+
/** Provides more information than toText, by showing the underlying Constraint details. */
60+
def debugBoundsDescription(using Context): String
5861
}
5962

6063
final class ProperGadtConstraint private(
@@ -290,6 +293,8 @@ final class ProperGadtConstraint private(
290293
override def constr = gadtsConstr
291294

292295
override def toText(printer: Printer): Texts.Text = printer.toText(this)
296+
297+
override def debugBoundsDescription(using Context): String = i"$this\n$constraint"
293298
}
294299

295300
@sharable object EmptyGadtConstraint extends GadtConstraint {
@@ -314,4 +319,5 @@ final class ProperGadtConstraint private(
314319
assert(!other.isNarrowing, "cannot restore a non-empty GADTMap")
315320

316321
override def toText(printer: Printer): Texts.Text = printer.toText(this)
322+
override def debugBoundsDescription(using Context): String = i"$this"
317323
}

0 commit comments

Comments
 (0)