Skip to content

Commit 0635cae

Browse files
committed
Merge pull request #229 from dotty-staging/change/typevar-printing
When printing uninstantiated type variables, include their bounds.
2 parents b444167 + d6d798a commit 0635cae

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,11 @@ class PlainPrinter(_ctx: Context) extends Printer {
142142
case AnnotatedType(annot, tpe) =>
143143
toTextLocal(tpe) ~ " " ~ toText(annot)
144144
case tp: TypeVar =>
145-
val suffix = if (tp.isInstantiated) "'" else "?"
146-
toTextLocal(tp.instanceOpt orElse tp.origin) ~ suffix // debug for now, so that we can see where the TypeVars are.
145+
if (tp.isInstantiated)
146+
toTextLocal(tp.instanceOpt) ~ "'" // debug for now, so that we can see where the TypeVars are.
147+
else
148+
"(" ~ toText(tp.origin) ~ "?" ~
149+
toText(ctx.typerState.constraint.bounds(tp.origin)) ~ ")"
147150
case _ =>
148151
tp.fallbackToText(this)
149152
}

0 commit comments

Comments
 (0)