File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed
compiler/src/dotty/tools/dotc/printing Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -697,6 +697,23 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
697
697
super .toText(sym)
698
698
}
699
699
700
+ override def toText (const : Constant ): Text =
701
+ if (! YprintRepl ) super .toText(const)
702
+ else if (const.tag == StringTag ) Str ('"' + const.value.toString + '"' )
703
+ else Str (const.value.toString)
704
+
705
+ override def dclText (sym : Symbol ): Text = {
706
+ if (! YprintRepl ) super .dclText(sym)
707
+ else {
708
+ toText(sym) ~ {
709
+ if (sym.is(Method )) toText(sym.info)
710
+ else if (sym.isType && sym.info.isInstanceOf [TypeAlias ]) toText(sym.info)
711
+ else if (sym.isType || sym.isClass) " "
712
+ else " :" ~~ toText(sym.info)
713
+ }
714
+ }
715
+ }
716
+
700
717
override def kindString (sym : Symbol ) = {
701
718
val flags = sym.flagsUNSAFE
702
719
if (flags is Package ) " package"
Original file line number Diff line number Diff line change @@ -12,15 +12,6 @@ class UserFacingPrinter(_ctx: Context) extends RefinedPrinter(_ctx) {
12
12
if (sym.name.isReplAssignName) nameString(sym.name)
13
13
else keyString(sym) ~~ nameString(sym.name.stripModuleClassSuffix)
14
14
15
- override def dclText (sym : Symbol ): Text = toText(sym) ~ {
16
- if (sym.is(Method )) toText(sym.info)
17
- else if (sym.isType && sym.info.isInstanceOf [TypeAlias ]) toText(sym.info)
18
- else if (sym.isType || sym.isClass) " "
19
- else " :" ~~ toText(sym.info)
20
- }
21
-
22
- override def toText (const : Constant ): Text = Str (const.value.toString)
23
-
24
15
override def toText (tp : Type ): Text = tp match {
25
16
case ExprType (result) => " :" ~~ toText(result)
26
17
case tp => super .toText(tp)
You can’t perform that action at this time.
0 commit comments