File tree 2 files changed +6
-4
lines changed
compiler/src/dotty/tools/dotc/printing 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
26
26
27
27
protected def maxToTextRecursions : Int = 100
28
28
29
+ protected def showUniqueIds = ctx.settings.uniqid.value || Printer .debugPrintUnique
30
+
29
31
protected final def limiter : MessageLimiter = ctx.property(MessageLimiter ).get
30
32
31
33
protected def controlled (op : => Text ): Text = limiter.controlled(op)
@@ -248,14 +250,14 @@ class PlainPrinter(_ctx: Context) extends Printer {
248
250
249
251
/** If -uniqid is set, the hashcode of the lambda type, after a # */
250
252
protected def lambdaHash (pt : LambdaType ): Text =
251
- if (ctx.settings.uniqid.value )
253
+ if (showUniqueIds )
252
254
try " #" + pt.hashCode
253
255
catch { case ex : NullPointerException => " " }
254
256
else " "
255
257
256
258
/** If -uniqid is set, the unique id of symbol, after a # */
257
259
protected def idString (sym : Symbol ): String =
258
- if (ctx.settings.uniqid.value || Printer .debugPrintUnique) " #" + sym.id else " "
260
+ if (showUniqueIds || Printer .debugPrintUnique) " #" + sym.id else " "
259
261
260
262
def nameString (sym : Symbol ): String =
261
263
simpleNameString(sym) + idString(sym) // + "<" + (if (sym.exists) sym.owner else "") + ">"
Original file line number Diff line number Diff line change @@ -213,7 +213,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
213
213
case tp : RefinedType if defn.isFunctionType(tp) && ! printDebug =>
214
214
toTextDependentFunction(tp.refinedInfo.asInstanceOf [MethodType ])
215
215
case tp : TypeRef =>
216
- if (tp.symbol.isAnonymousClass && ! ctx.settings.uniqid.value )
216
+ if (tp.symbol.isAnonymousClass && ! showUniqueIds )
217
217
toText(tp.info)
218
218
else if (tp.symbol.is(Param ))
219
219
tp.prefix match {
@@ -729,7 +729,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
729
729
protected def optAscription [T >: Untyped ](tpt : Tree [T ]): Text = optText(tpt)(" : " ~ _)
730
730
731
731
private def idText (tree : untpd.Tree ): Text =
732
- if ((ctx.settings.uniqid.value || Printer .debugPrintUnique) && tree.hasType && tree.symbol.exists) s " # ${tree.symbol.id}" else " "
732
+ if showUniqueIds && tree.hasType && tree.symbol.exists then s " # ${tree.symbol.id}" else " "
733
733
734
734
private def useSymbol (tree : untpd.Tree ) =
735
735
tree.hasType && tree.symbol.exists && ctx.settings.YprintSyms .value
You can’t perform that action at this time.
0 commit comments