Skip to content

Commit 832d2f4

Browse files
committed
Ignore compiletime.testing for now
1 parent e2e222c commit 832d2f4

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

compiler/src/dotty/tools/dotc/transform/CheckUnused.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ object CheckUnused:
501501
if inliners == 0
502502
&& languageImport(imp.expr).isEmpty
503503
&& !imp.isGeneratedByEnum
504+
&& !imp.isCompiletimeTesting
504505
&& !ctx.owner.name.isReplWrapperName
505506
then
506507
imps.put(imp, ())
@@ -1031,6 +1032,10 @@ object CheckUnused:
10311032
def isGeneratedByEnum: Boolean =
10321033
imp.symbol.exists && imp.symbol.owner.is(Enum, butNot = Case)
10331034

1035+
/** No mechanism for detection yet. */
1036+
def isCompiletimeTesting: Boolean =
1037+
imp.expr.symbol == defn.CompiletimeTestingPackage//.moduleClass
1038+
10341039
extension (pos: SrcPos)
10351040
def isZeroExtentSynthetic: Boolean = pos.span.isSynthetic && pos.span.isZeroExtent
10361041
def isSynthetic: Boolean = pos.span.isSynthetic && pos.span.exists

tests/warn/i21805.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
def i23967: Boolean = {
44
//import scala.compiletime.testing.typeCheckErrors
5-
import scala.compiletime.testing.* // warn
5+
import scala.compiletime.testing.* // nowarn
66
typeChecks("2 + 2")
77
}
88

@@ -21,10 +21,10 @@ package q:
2121

2222
package i23967b:
2323
package ok:
24-
import scala.compiletime.testing.* // warn
24+
import scala.compiletime.testing.* // nowarn
2525
def test() = typeChecks("42 + 27")
2626
package nok:
27-
import scala.compiletime.testing.typeChecks // warn
27+
import scala.compiletime.testing.typeChecks // nowarn
2828
def test() = typeChecks("42 + 27")
2929

3030
@main def Test = println:

0 commit comments

Comments
 (0)