Skip to content

Commit b5d20c8

Browse files
committed
Remove warnings in Test infrastructure
1 parent 2cd2472 commit b5d20c8

13 files changed

+57
-57
lines changed

compiler/test/dotc/comptest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ object comptest extends ParallelTesting {
2727
dotcDir + "tools/dotc/ast/Trees.scala"
2828
),
2929
TestFlags("", Array("-Ylog:typer", "-Xprompt"))
30-
)(TestGroup("comptest"))
30+
)(using TestGroup("comptest"))
3131
}

compiler/test/dotty/tools/dotc/CompilationTests.scala

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ class CompilationTests {
210210
implicit val testGroup: TestGroup = TestGroup("explicitNullsNeg")
211211
aggregateTests(
212212
compileFilesInDir("tests/explicit-nulls/neg", explicitNullsOptions, FileFilter.exclude(TestSources.negExplicitNullsScala2LibraryTastyExcludelisted)),
213-
compileFilesInDir("tests/explicit-nulls/flexible-types-common", explicitNullsOptions and "-Yno-flexible-types"),
214-
compileFilesInDir("tests/explicit-nulls/unsafe-common", explicitNullsOptions and "-Yno-flexible-types", FileFilter.exclude(TestSources.negExplicitNullsScala2LibraryTastyExcludelisted)),
213+
compileFilesInDir("tests/explicit-nulls/flexible-types-common", explicitNullsOptions `and` "-Yno-flexible-types"),
214+
compileFilesInDir("tests/explicit-nulls/unsafe-common", explicitNullsOptions `and` "-Yno-flexible-types", FileFilter.exclude(TestSources.negExplicitNullsScala2LibraryTastyExcludelisted)),
215215
).checkExpectedErrors()
216216

217217
locally {
@@ -231,12 +231,12 @@ class CompilationTests {
231231
aggregateTests(
232232
compileFilesInDir("tests/explicit-nulls/pos", explicitNullsOptions),
233233
compileFilesInDir("tests/explicit-nulls/flexible-types-common", explicitNullsOptions),
234-
compileFilesInDir("tests/explicit-nulls/unsafe-common", explicitNullsOptions and "-language:unsafeNulls" and "-Yno-flexible-types"),
234+
compileFilesInDir("tests/explicit-nulls/unsafe-common", explicitNullsOptions `and` "-language:unsafeNulls" `and` "-Yno-flexible-types"),
235235
).checkCompile()
236236

237237
locally {
238238
val tests = List(
239-
compileFile("tests/explicit-nulls/flexible-unpickle/pos/Unsafe_1.scala", explicitNullsOptions without "-Yexplicit-nulls"),
239+
compileFile("tests/explicit-nulls/flexible-unpickle/pos/Unsafe_1.scala", explicitNullsOptions `without` "-Yexplicit-nulls"),
240240
compileFile("tests/explicit-nulls/flexible-unpickle/pos/Flexible_2.scala",
241241
explicitNullsOptions.and("-Yflexify-tasty").withClasspath(defaultOutputDir + testGroup + "/Unsafe_1/pos/Unsafe_1")),
242242
).map(_.keepOutput.checkCompile())
@@ -289,9 +289,9 @@ class CompilationTests {
289289
val outDir2 = defaultOutputDir + i12128Group + "/Macro_2/i12128/Macro_2"
290290

291291
val tests = List(
292-
compileFile("tests/init/special/i12128/Reflect_1.scala", i12128Options)(i12128Group),
293-
compileFile("tests/init/special/i12128/Macro_2.scala", i12128Options.withClasspath(outDir1))(i12128Group),
294-
compileFile("tests/init/special/i12128/Test_3.scala", options.withClasspath(outDir2))(i12128Group)
292+
compileFile("tests/init/special/i12128/Reflect_1.scala", i12128Options)(using i12128Group),
293+
compileFile("tests/init/special/i12128/Macro_2.scala", i12128Options.withClasspath(outDir1))(using i12128Group),
294+
compileFile("tests/init/special/i12128/Test_3.scala", options.withClasspath(outDir2))(using i12128Group)
295295
).map(_.keepOutput.checkCompile())
296296

297297
tests.foreach(_.delete())
@@ -310,12 +310,12 @@ class CompilationTests {
310310
val classB1 = defaultOutputDir + tastyErrorGroup + "/B/v1/B"
311311

312312
val tests = List(
313-
compileFile("tests/init/tasty-error/val-or-defdef/v1/A.scala", tastyErrorOptions)(tastyErrorGroup),
314-
compileFile("tests/init/tasty-error/val-or-defdef/v1/B.scala", tastyErrorOptions.withClasspath(classA1))(tastyErrorGroup),
315-
compileFile("tests/init/tasty-error/val-or-defdef/v0/A.scala", tastyErrorOptions)(tastyErrorGroup),
313+
compileFile("tests/init/tasty-error/val-or-defdef/v1/A.scala", tastyErrorOptions)(using tastyErrorGroup),
314+
compileFile("tests/init/tasty-error/val-or-defdef/v1/B.scala", tastyErrorOptions.withClasspath(classA1))(using tastyErrorGroup),
315+
compileFile("tests/init/tasty-error/val-or-defdef/v0/A.scala", tastyErrorOptions)(using tastyErrorGroup),
316316
).map(_.keepOutput.checkCompile())
317317

318-
compileFile("tests/init/tasty-error/val-or-defdef/Main.scala", tastyErrorOptions.withClasspath(classA0).withClasspath(classB1))(tastyErrorGroup).checkExpectedErrors()
318+
compileFile("tests/init/tasty-error/val-or-defdef/Main.scala", tastyErrorOptions.withClasspath(classA0).withClasspath(classB1))(using tastyErrorGroup).checkExpectedErrors()
319319

320320
tests.foreach(_.delete())
321321
}
@@ -334,13 +334,13 @@ class CompilationTests {
334334
val classB1 = defaultOutputDir + tastyErrorGroup + "/B/v1/B"
335335

336336
val tests = List(
337-
compileFile("tests/init/tasty-error/typedef/C.scala", tastyErrorOptions)(tastyErrorGroup),
338-
compileFile("tests/init/tasty-error/typedef/v1/A.scala", tastyErrorOptions.withClasspath(classC))(tastyErrorGroup),
339-
compileFile("tests/init/tasty-error/typedef/v1/B.scala", tastyErrorOptions.withClasspath(classC).withClasspath(classA1))(tastyErrorGroup),
340-
compileFile("tests/init/tasty-error/typedef/v0/A.scala", tastyErrorOptions.withClasspath(classC))(tastyErrorGroup),
337+
compileFile("tests/init/tasty-error/typedef/C.scala", tastyErrorOptions)(using tastyErrorGroup),
338+
compileFile("tests/init/tasty-error/typedef/v1/A.scala", tastyErrorOptions.withClasspath(classC))(using tastyErrorGroup),
339+
compileFile("tests/init/tasty-error/typedef/v1/B.scala", tastyErrorOptions.withClasspath(classC).withClasspath(classA1))(using tastyErrorGroup),
340+
compileFile("tests/init/tasty-error/typedef/v0/A.scala", tastyErrorOptions.withClasspath(classC))(using tastyErrorGroup),
341341
).map(_.keepOutput.checkCompile())
342342

343-
compileFile("tests/init/tasty-error/typedef/Main.scala", tastyErrorOptions.withClasspath(classC).withClasspath(classA0).withClasspath(classB1))(tastyErrorGroup).checkExpectedErrors()
343+
compileFile("tests/init/tasty-error/typedef/Main.scala", tastyErrorOptions.withClasspath(classC).withClasspath(classA0).withClasspath(classB1))(using tastyErrorGroup).checkExpectedErrors()
344344

345345
tests.foreach(_.delete())
346346
}

compiler/test/dotty/tools/dotc/IdempotencyTests.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class IdempotencyTests {
3030
val opt = defaultOptions
3131

3232
val posIdempotency = aggregateTests(
33-
compileFilesInDir("tests/pos", opt, filter)(TestGroup("idempotency/posIdempotency1")),
34-
compileFilesInDir("tests/pos", opt, filter)(TestGroup("idempotency/posIdempotency2")),
33+
compileFilesInDir("tests/pos", opt, filter)(using TestGroup("idempotency/posIdempotency1")),
34+
compileFilesInDir("tests/pos", opt, filter)(using TestGroup("idempotency/posIdempotency2")),
3535
)
3636

3737
val orderIdempotency = {
@@ -41,16 +41,16 @@ class IdempotencyTests {
4141
} yield {
4242
val sources = TestSources.sources(testDir.toPath)
4343
aggregateTests(
44-
compileList(testDir.getName, sources, opt)(TestGroup("idempotency/orderIdempotency1")),
45-
compileList(testDir.getName, sources.reverse, opt)(TestGroup("idempotency/orderIdempotency2"))
44+
compileList(testDir.getName, sources, opt)(using TestGroup("idempotency/orderIdempotency1")),
45+
compileList(testDir.getName, sources.reverse, opt)(using TestGroup("idempotency/orderIdempotency2"))
4646
)
4747
}
4848
aggregateTests(tests*)
4949
}
5050

5151
def check(name: String) = {
5252
val files = List(s"tests/idempotency/$name.scala", "tests/idempotency/IdempotencyCheck.scala")
53-
compileList(name, files, defaultOptions)(TestGroup("idempotency/check"))
53+
compileList(name, files, defaultOptions)(using TestGroup("idempotency/check"))
5454
}
5555
val allChecks = aggregateTests(
5656
check("CheckOrderIdempotency"),

compiler/test/dotty/tools/dotc/SettingsTests.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class SettingsTests {
218218

219219
assertNotEquals(fileStateBefore, String(Files.readAllBytes(file)), "Jar should have been overriden")
220220

221-
}(Files.deleteIfExists(_))
221+
}(using Files.deleteIfExists(_))
222222

223223
@Test def `Output setting is respecting previous setting`: Unit =
224224
val result = Using.resources(
@@ -263,7 +263,7 @@ class SettingsTests {
263263

264264
assertEquals(fileStateBefore, String(Files.readAllBytes(file)))
265265

266-
}(Files.deleteIfExists(_))
266+
}(using Files.deleteIfExists(_))
267267

268268
@Test def `Arguments of flags are correctly parsed with both ":" and " " separating`: Unit =
269269
object Settings extends SettingGroup:
@@ -319,7 +319,7 @@ class SettingsTests {
319319
testValues(summary = summaryColon)
320320
testValues(summary = summaryWhitespace)
321321

322-
}(Files.deleteIfExists(_))
322+
}(using Files.deleteIfExists(_))
323323

324324
private def withProcessedArgs(summary: ArgsSummary)(f: SettingsState ?=> Unit) = f(using summary.sstate)
325325

compiler/test/dotty/tools/dotc/TastyBootstrapTests.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ class TastyBootstrapTests {
6161
compileList("lib", librarySources,
6262
defaultOptions.and("-Ycheck-reentrant",
6363
// "-source", "future", // TODO: re-enable once library uses updated syntax for vararg splices, wildcard imports, and import renaming
64-
))(libGroup)
64+
))(using libGroup)
6565

6666
val tastyCoreSources = sources(Paths.get("tasty/src"))
67-
val tastyCore = compileList("tastyCore", tastyCoreSources, opt)(tastyCoreGroup)
67+
val tastyCore = compileList("tastyCore", tastyCoreSources, opt)(using tastyCoreGroup)
6868

6969
val compilerSources = sources(Paths.get("compiler/src")) ++ sources(Paths.get("compiler/src-bootstrapped"))
7070
val compilerManagedSources = Properties.dottyCompilerManagedSources match
7171
case p if Files.isDirectory(p) => sources(p)
7272
case _ => Nil
7373

74-
val dotty1 = compileList("dotty1", compilerSources ++ compilerManagedSources, opt)(dotty1Group)
75-
val dotty2 = compileList("dotty2", compilerSources ++ compilerManagedSources, opt)(dotty2Group)
74+
val dotty1 = compileList("dotty1", compilerSources ++ compilerManagedSources, opt)(using dotty1Group)
75+
val dotty2 = compileList("dotty2", compilerSources ++ compilerManagedSources, opt)(using dotty2Group)
7676

7777
val tests = {
7878
lib.keepOutput :: tastyCore.keepOutput :: dotty1.keepOutput :: aggregateTests(

compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class ScalaSettingsTests:
9292

9393
@nowarn("cat=deprecation")
9494
@Test def `Deprecated options are correctly mapped to their replacements`: Unit =
95-
def createTestCase(oldSetting: Setting[_], newSetting: Setting[_], value: String = "") =
95+
def createTestCase(oldSetting: Setting[?], newSetting: Setting[?], value: String = "") =
9696
s"${oldSetting.name}$value" -> newSetting
9797

9898
val settings = ScalaSettings
@@ -121,7 +121,7 @@ class ScalaSettingsTests:
121121

122122
@nowarn("cat=deprecation")
123123
@Test def `Deprecated options should not be set if old option was incorrect`: Unit =
124-
def createTestCase(oldSetting: Setting[_], newSetting: Setting[_], value: String = ":illegal") =
124+
def createTestCase(oldSetting: Setting[?], newSetting: Setting[?], value: String = ":illegal") =
125125
s"${oldSetting.name}:$value" -> newSetting
126126

127127
val settings = ScalaSettings
@@ -161,7 +161,7 @@ class ScalaSettingsTests:
161161

162162
@nowarn("cat=deprecation")
163163
@Test def `Deprecated options aliases are correctly mapped to their replacements`: Unit =
164-
def createTestCase(oldSetting: Setting[_], newSetting: Setting[_], value: String = "") =
164+
def createTestCase(oldSetting: Setting[?], newSetting: Setting[?], value: String = "") =
165165
oldSetting.aliases.map: alias =>
166166
s"$alias$value" -> newSetting
167167

@@ -250,7 +250,7 @@ class ScalaSettingsTests:
250250
)
251251
)
252252
)
253-
}(Files.deleteIfExists(_))
253+
}(using Files.deleteIfExists(_))
254254
assertEquals(result, Right(reporting.Action.Silent))
255255

256256
@Test def `WConf src filter doesn't silence warnings from a non-matching path for real file`: Unit =
@@ -265,7 +265,7 @@ class ScalaSettingsTests:
265265
)
266266
)
267267
)
268-
}(Files.deleteIfExists(_))
268+
}(using Files.deleteIfExists(_))
269269
assertEquals(result, Right(reporting.Action.Warning))
270270

271271
@Test def `WConf src filter reports an error on an invalid regex`: Unit =

compiler/test/dotty/tools/dotc/core/tasty/CommentPicklingTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import dotty.tools.io.AbstractFile
2222

2323
class CommentPicklingTest {
2424

25-
val compileOptions = TestConfiguration.defaultOptions and "-Ykeep-comments" and "-Yemit-tasty"
25+
val compileOptions = TestConfiguration.defaultOptions `and` "-Ykeep-comments" `and` "-Yemit-tasty"
2626
val unpickleOptions = TestConfiguration.defaultOptions
2727

2828
@Test def commentOnDef: Unit = {

compiler/test/dotty/tools/dotc/parsing/ScannerTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ class ScannerTest extends DottyTest {
3333
def scanDir(path: String): Unit = scanDir(Directory(path))
3434

3535
def scanDir(dir: Directory): Unit = {
36-
if (excluded exists (dir.jpath.toString endsWith _))
36+
if excluded.exists(dir.jpath.toString.endsWith(_)) then
3737
println(s"excluded package: ${dir.toAbsolute.jpath}")
3838
else
3939
for (f <- dir.files)
4040
if (f.name.endsWith(".scala"))
41-
if (excluded exists (f.jpath.toString endsWith _))
41+
if excluded.exists(f.jpath.toString.endsWith(_)) then
4242
println(s"excluded file: ${f.toAbsolute.jpath}")
4343
else
4444
scan(new PlainFile(f))

compiler/test/dotty/tools/dotc/sbt/ProgressCallbackTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ final class ProgressCallbackTest extends DottyTest:
149149
assertEquals(s"Phase $recordedCurr was not expected", expectedCurr, recordedCurr)
150150

151151
val (seenCurrPhases, seenNextPhases) =
152-
val (currs0, nexts0) = progressCallback.progressPhasesFinal.unzip(Tuple.fromProductTyped)
152+
val (currs0, nexts0) = progressCallback.progressPhasesFinal.unzip(using Tuple.fromProductTyped)
153153
(currs0.toSet, nexts0.toSet)
154154

155155
val missingCurrPhases = expectedCurrPhases.diff(seenCurrPhases)

compiler/test/dotty/tools/repl/AbstractFileClassLoaderTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class AbstractFileClassLoaderTest:
1818
def closing[T <: Closeable, U](stream: T)(f: T => U): U = try f(stream) finally stream.close()
1919

2020
extension (f: AbstractFile) def writeContent(s: String): Unit = closing(f.bufferedOutput)(_.write(s.getBytes(UTF8.charSet)))
21-
def slurp(inputStream: => InputStream)(implicit codec: Codec): String = closing(Source.fromInputStream(inputStream)(codec))(_.mkString)
21+
def slurp(inputStream: => InputStream)(implicit codec: Codec): String = closing(Source.fromInputStream(inputStream)(using codec))(_.mkString)
2222
def slurp(url: URL)(implicit codec: Codec): String = slurp(url.openStream())
2323

2424
extension (input: InputStream) def bytes: Array[Byte] =

0 commit comments

Comments
 (0)