Skip to content

Commit 4c29e97

Browse files
committed
Print arguments of annotations
So far, annotations of symbols printed as just the class name; also include their arguments. But avoid this for Body annotations, since they just repeat the possibly large body of an inline function.
1 parent 0ad992f commit 4c29e97

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,11 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
886886

887887
protected def annotText(tree: untpd.Tree): Text = "@" ~ constrText(tree) // DD
888888

889+
override def annotsText(sym: Symbol): Text =
890+
Text(sym.annotations.map(ann =>
891+
if ann.symbol == defn.BodyAnnot then Str(simpleNameString(ann.symbol))
892+
else annotText(ann.tree)))
893+
889894
protected def modText(mods: untpd.Modifiers, sym: Symbol, kw: String, isType: Boolean): Text = { // DD
890895
val suppressKw = if (enclDefIsClass) mods.isAllOf(LocalParam) else mods.is(Param)
891896
var flagMask =

0 commit comments

Comments
 (0)