Skip to content

Commit d2b01d0

Browse files
committed
Improve printing when debugging
- print hashes for term params under -uniqid - don't print RefinedTypes as dependent function types under -Ydebug-print
1 parent ce9cd39 commit d2b01d0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
146146
else
147147
toTextPrefix(tp.prefix) ~ selectionString(tp)
148148
case tp: TermParamRef =>
149-
ParamRefNameString(tp) ~ ".type"
149+
ParamRefNameString(tp) ~ lambdaHash(tp.binder) ~ ".type"
150150
case tp: TypeParamRef =>
151151
ParamRefNameString(tp) ~ lambdaHash(tp.binder)
152152
case tp: SingletonType =>
@@ -237,9 +237,10 @@ class PlainPrinter(_ctx: Context) extends Printer {
237237
def toTextSingleton(tp: SingletonType): Text =
238238
"(" ~ toTextRef(tp) ~ " : " ~ toTextGlobal(tp.underlying) ~ ")"
239239

240-
protected def paramsText(tp: LambdaType): Text = {
241-
def paramText(name: Name, tp: Type) = toText(name) ~ toTextRHS(tp)
242-
Text(tp.paramNames.lazyZip(tp.paramInfos).map(paramText), ", ")
240+
protected def paramsText(lam: LambdaType): Text = {
241+
def paramText(name: Name, tp: Type) =
242+
toText(name) ~ lambdaHash(lam) ~ toTextRHS(tp)
243+
Text(lam.paramNames.lazyZip(lam.paramInfos).map(paramText), ", ")
243244
}
244245

245246
protected def ParamRefNameString(name: Name): String = name.toString

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
212212
toTextInfixType(tpnme.raw.BAR, tp1, tp2) { toText(tpnme.raw.BAR) }
213213
case EtaExpansion(tycon) if !printDebug =>
214214
toText(tycon)
215-
case tp: RefinedType if defn.isFunctionType(tp) =>
215+
case tp: RefinedType if defn.isFunctionType(tp) && !printDebug =>
216216
toTextDependentFunction(tp.refinedInfo.asInstanceOf[MethodType])
217217
case tp: TypeRef =>
218218
if (tp.symbol.isAnonymousClass && !ctx.settings.uniqid.value)

0 commit comments

Comments
 (0)