Skip to content

Commit 209ae55

Browse files
committed
Don't print @sourcefile annotation with -YprintUser
1 parent 9dfeabd commit 209ae55

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
@@ -275,7 +275,10 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
275275
if (homogenizedView && mods.flags.isTypeFlags) flagMask &~= Implicit // drop implicit from classes
276276
val flags = mods.flags & flagMask
277277
val flagsText = if (flags.isEmpty) "" else keywordStr((mods.flags & flagMask).toString)
278-
Text(mods.annotations.map(annotText), " ") ~~ flagsText ~~ (Str(kw) provided !suppressKw)
278+
val annotations =
279+
if (YprintUser) mods.annotations.filter(_.tpe != defn.SourceFileAnnotType)
280+
else mods.annotations
281+
Text(annotations.map(annotText), " ") ~~ flagsText ~~ (Str(kw) provided !suppressKw)
279282
}
280283

281284
def varianceText(mods: untpd.Modifiers) =

0 commit comments

Comments
 (0)