File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
compiler/src/dotty/tools/dotc/printing Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -128,8 +128,13 @@ object Formatting {
128
128
}
129
129
130
130
private class ExplainingPrinter (seen : Seen )(_ctx : Context ) extends RefinedPrinter (_ctx) {
131
+
132
+ /** True if printer should a source module instead of its module class */
133
+ private def useSourceModule (sym : Symbol ): Boolean =
134
+ sym.is(ModuleClass , butNot = Package ) && sym.sourceModule.exists && ! _ctx.settings.YdebugNames .value
135
+
131
136
override def simpleNameString (sym : Symbol ): String =
132
- if ((sym is ModuleClass ) && sym.sourceModule.exists ) simpleNameString(sym.sourceModule)
137
+ if (useSourceModule (sym) ) simpleNameString(sym.sourceModule)
133
138
else seen.record(super .simpleNameString(sym), sym)
134
139
135
140
override def ParamRefNameString (param : ParamRef ): String =
@@ -139,6 +144,11 @@ object Formatting {
139
144
case tp : SkolemType => seen.record(tp.repr.toString, tp)
140
145
case _ => super .toTextRef(tp)
141
146
}
147
+
148
+ override def toText (tp : Type ): Text = tp match {
149
+ case tp : TypeRef if useSourceModule(tp.symbol) => Str (" object " ) ~ super .toText(tp)
150
+ case _ => super .toText(tp)
151
+ }
142
152
}
143
153
144
154
/** Create explanation for single `Recorded` type or symbol */
You can’t perform that action at this time.
0 commit comments