@@ -501,10 +501,12 @@ object CheckUnused:
501501 if inliners == 0
502502 && languageImport(imp.expr).isEmpty
503503 && ! imp.isGeneratedByEnum
504- && ! imp.isCompiletimeTesting
505504 && ! ctx.owner.name.isReplWrapperName
506505 then
507- imps.put(imp, ())
506+ if imp.isCompiletimeTesting then
507+ isNullified = true
508+ else
509+ imps.put(imp, ())
508510 case tree : Bind =>
509511 if ! tree.name.isInstanceOf [DerivedName ] && ! tree.name.is(WildcardParamName ) then
510512 if tree.hasAttachment(NoWarn ) then
@@ -534,6 +536,9 @@ object CheckUnused:
534536 asss.addOne(sym)
535537 else
536538 refs.addOne(sym)
539+
540+ // currently compiletime.testing is completely erased, so ignore the unit
541+ var isNullified = false
537542 end RefInfos
538543
539544 // Names are resolved by definitions and imports, which have four precedence levels:
@@ -548,7 +553,7 @@ object CheckUnused:
548553 inline def weakerThan (q : Precedence ): Boolean = p > q
549554 inline def isNone : Boolean = p == NoPrecedence
550555
551- def reportUnused ()(using Context ): Unit =
556+ def reportUnused ()(using Context ): Unit = if ! refInfos.isNullified then
552557 for (msg, pos, origin) <- warnings do
553558 if origin.isEmpty then report.warning(msg, pos)
554559 else report.warning(msg, pos, origin)
0 commit comments