Skip to content

Commit 419cd87

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 b3d0c47 commit 419cd87

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
@@ -881,6 +881,11 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
881881

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

884+
override def annotsText(sym: Symbol): Text =
885+
Text(sym.annotations.map(ann =>
886+
if ann.symbol == defn.BodyAnnot then Str(simpleNameString(ann.symbol))
887+
else annotText(ann.tree)))
888+
884889
protected def modText(mods: untpd.Modifiers, sym: Symbol, kw: String, isType: Boolean): Text = { // DD
885890
val suppressKw = if (enclDefIsClass) mods.isAllOf(LocalParam) else mods.is(Param)
886891
var flagMask =

0 commit comments

Comments
 (0)