Skip to content

Commit 046f52a

Browse files
committed
Fix printing untyped annotations
1 parent 692cbe5 commit 046f52a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,11 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
974974
val explicitArgs = args.filterNot(_.symbol.name.is(DefaultGetterName))
975975
recur(fn) ~ "(" ~ toTextGlobal(explicitArgs, ", ") ~ ")"
976976
case TypeApply(fn, args) => recur(fn) ~ "[" ~ toTextGlobal(args, ", ") ~ "]"
977-
case _ => s"@${sym.orElse(tree.symbol).name}"
977+
case Select(qual, nme.CONSTRUCTOR) => recur(qual)
978+
case New(tpt) => recur(tpt)
979+
case _ =>
980+
val annotSym = sym.orElse(tree.symbol.enclosingClass)
981+
s"@${if annotSym.exists then annotSym.name.toString else t.show}"
978982
recur(tree)
979983

980984
protected def modText(mods: untpd.Modifiers, sym: Symbol, kw: String, isType: Boolean): Text = { // DD

0 commit comments

Comments
 (0)