Skip to content

Commit e586281

Browse files
committed
Don't print @sourcefile annotation with -YprintUser
1 parent 97868f0 commit e586281

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,10 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
281281
if (homogenizedView && mods.flags.isTypeFlags) flagMask &~= Implicit // drop implicit from classes
282282
val flags = mods.flags & flagMask
283283
val flagsText = if (flags.isEmpty) "" else keywordStr((mods.flags & flagMask).toString)
284-
Text(mods.annotations.map(annotText), " ") ~~ flagsText ~~ (Str(kw) provided !suppressKw)
284+
val annotations =
285+
if (YprintUser) mods.annotations.filter(_.tpe != defn.SourceFileAnnotType)
286+
else mods.annotations
287+
Text(annotations.map(annotText), " ") ~~ flagsText ~~ (Str(kw) provided !suppressKw)
285288
}
286289

287290
def varianceText(mods: untpd.Modifiers) =

0 commit comments

Comments
 (0)