Skip to content

Commit 3db7cff

Browse files
som-snytttgodzik
authored andcommitted
Ignore compiletime.testing for now
[Cherry-picked 4d28ffd]
1 parent b94b283 commit 3db7cff

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
@@ -473,6 +473,7 @@ object CheckUnused:
473473
if inliners == 0
474474
&& languageImport(imp.expr).isEmpty
475475
&& !imp.isGeneratedByEnum
476+
&& !imp.isCompiletimeTesting
476477
&& !ctx.owner.name.isReplWrapperName
477478
then
478479
imps.put(imp, ())
@@ -1003,6 +1004,10 @@ object CheckUnused:
10031004
def isGeneratedByEnum: Boolean =
10041005
imp.symbol.exists && imp.symbol.owner.is(Enum, butNot = Case)
10051006

1007+
/** No mechanism for detection yet. */
1008+
def isCompiletimeTesting: Boolean =
1009+
imp.expr.symbol == defn.CompiletimeTestingPackage//.moduleClass
1010+
10061011
extension (pos: SrcPos)
10071012
def isZeroExtentSynthetic: Boolean = pos.span.isSynthetic && pos.span.isZeroExtent
10081013
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)