File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed
compiler/src/dotty/tools/dotc/printing Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
116
116
super .toTextPrefix(tp)
117
117
}
118
118
119
+ override protected def toTextParents (parents : List [Type ]): Text =
120
+ Text (parents.map(toTextLocal).map(typeText), keywordStr(" with " ))
121
+
119
122
override protected def refinementNameString (tp : RefinedType ): String =
120
123
if (tp.parent.isInstanceOf [WildcardType ] || tp.refinedName == nme.WILDCARD )
121
124
super .refinementNameString(tp)
@@ -825,14 +828,21 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
825
828
case info : ImportType => return s " import $info.expr.show "
826
829
case _ =>
827
830
}
828
- if (sym.is(ModuleClass )) {
829
- val name =
830
- if (sym.isPackageObject && sym.name.stripModuleClassSuffix == tpnme.PACKAGE ) sym.owner.name
831
- else sym.name.stripModuleClassSuffix
832
- kindString(sym) ~~ (nameString(name) + idString(sym))
833
- }
834
- else
835
- super .toText(sym)
831
+ def name =
832
+ if (sym.is(ModuleClass ) && sym.isPackageObject && sym.name.stripModuleClassSuffix == tpnme.PACKAGE )
833
+ nameString(sym.owner.name)
834
+ else if (sym.is(ModuleClass ))
835
+ nameString(sym.name.stripModuleClassSuffix)
836
+ else if (hasMeaninglessName(sym))
837
+ simpleNameString(sym.owner)
838
+ else
839
+ nameString(sym)
840
+ (keywordText(kindString(sym)) ~~ {
841
+ if (sym.isAnonymousClass)
842
+ toTextParents(sym.info.parents) ~~ " {...}"
843
+ else
844
+ typeText(name)
845
+ }).close
836
846
}
837
847
838
848
/** String representation of symbol's kind. */
You can’t perform that action at this time.
0 commit comments