@@ -679,7 +679,8 @@ trait Printers
679679 if (vdef.symbol.flags.is(Flags .Mutable )) this += highlightKeyword(" var " )
680680 else this += highlightKeyword(" val " )
681681
682- this += highlightValDef(name) += " : "
682+ val name1 = splicedName(vdef.symbol).getOrElse(name)
683+ this += highlightValDef(name1) += " : "
683684 printTypeTree(tpt)
684685 rhs match {
685686 case Some (tree) =>
@@ -714,7 +715,8 @@ trait Printers
714715
715716 printProtectedOrPrivate(ddef)
716717
717- this += highlightKeyword(" def " ) += highlightValDef((if (isConstructor) " this" else name))
718+ val name1 : String = if (isConstructor) " this" else splicedName(ddef.symbol).getOrElse(name)
719+ this += highlightKeyword(" def " ) += highlightValDef(name1)
718720 printTargsDefs(targs.zip(targs))
719721 val it = argss.iterator
720722 while (it.hasNext)
@@ -734,8 +736,11 @@ trait Printers
734736 case Ident (" _" ) =>
735737 this += " _"
736738
737- case IsTerm (tree @ Ident (_)) =>
738- printType(tree.tpe)
739+ case IsIdent (tree) =>
740+ splicedName(tree.symbol) match {
741+ case Some (name) => this += name
742+ case _ => printType(tree.tpe)
743+ }
739744
740745 case Select (qual, name) =>
741746 printQualTree(qual)
@@ -1637,12 +1642,15 @@ trait Printers
16371642
16381643 def printAnnotation (annot : Term )(given elideThis : Option [Symbol ]): Buffer = {
16391644 val Annotation (ref, args) = annot
1640- this += " @"
1641- printTypeTree(ref)
1642- if (args.isEmpty)
1643- this
1644- else
1645- inParens(printTrees(args, " , " ))
1645+ if (annot.symbol.owner.fullName == " scala.quoted.show.showName" ) this
1646+ else {
1647+ this += " @"
1648+ printTypeTree(ref)
1649+ if (args.isEmpty)
1650+ this
1651+ else
1652+ inParens(printTrees(args, " , " ))
1653+ }
16461654 }
16471655
16481656 def printDefAnnotations (definition : Definition )(given elideThis : Option [Symbol ]): Buffer = {
@@ -1809,6 +1817,14 @@ trait Printers
18091817 private def escapedString (str : String ): String = str flatMap escapedChar
18101818 }
18111819
1820+ private def splicedName (sym : Symbol )(given ctx : Context ): Option [String ] = {
1821+ sym.annots.find(_.symbol.owner.fullName == " scala.quoted.show.showName" ).flatMap {
1822+ case Apply (_, Literal (Constant (c : String )) :: Nil ) => Some (c)
1823+ case Apply (_, Inlined (_, _, Literal (Constant (c : String ))) :: Nil ) => Some (c)
1824+ case annot => None
1825+ }
1826+ }
1827+
18121828 private object SpecialOp {
18131829 def unapply (arg : Tree )(given ctx : Context ): Option [(String , List [Term ])] = arg match {
18141830 case IsTerm (arg @ Apply (fn, args)) =>
0 commit comments