@@ -473,10 +473,12 @@ object CheckUnused:
473473 if inliners == 0
474474 && languageImport(imp.expr).isEmpty
475475 && ! imp.isGeneratedByEnum
476- && ! imp.isCompiletimeTesting
477476 && ! ctx.owner.name.isReplWrapperName
478477 then
479- imps.put(imp, ())
478+ if imp.isCompiletimeTesting then
479+ isNullified = true
480+ else
481+ imps.put(imp, ())
480482 case tree : Bind =>
481483 if ! tree.name.isInstanceOf [DerivedName ] && ! tree.name.is(WildcardParamName ) then
482484 if tree.hasAttachment(NoWarn ) then
@@ -506,6 +508,9 @@ object CheckUnused:
506508 asss.addOne(sym)
507509 else
508510 refs.addOne(sym)
511+
512+ // currently compiletime.testing is completely erased, so ignore the unit
513+ var isNullified = false
509514 end RefInfos
510515
511516 // Names are resolved by definitions and imports, which have four precedence levels:
@@ -520,7 +525,7 @@ object CheckUnused:
520525 inline def weakerThan (q : Precedence ): Boolean = p > q
521526 inline def isNone : Boolean = p == NoPrecedence
522527
523- def reportUnused ()(using Context ): Unit =
528+ def reportUnused ()(using Context ): Unit = if ! refInfos.isNullified then
524529 for (msg, pos, origin) <- warnings do
525530 if origin.isEmpty then report.warning(msg, pos)
526531 else report.warning(msg, pos, origin)
0 commit comments