Skip to content

Commit cae9eeb

Browse files
committed
Ensure consecutive -Wconf:* flags are not ignored
1 parent edd0516 commit cae9eeb

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

modules/integration/src/test/scala/scala/cli/integration/SipScalaTests.scala

+33
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,39 @@ class SipScalaTests extends ScalaCliSuite with SbtTestHelper with MillTestHelper
515515
}
516516
}
517517

518+
test("consecutive -Wconf:* flags are not ignored") {
519+
val sv = "3.5.2"
520+
val sourceFileName = "example.scala"
521+
val warningConfOptions = Seq("-Wconf:cat=deprecation:e", "-Wconf:any:s")
522+
TestInputs(os.rel / sourceFileName ->
523+
s"""//> using scala $sv
524+
|//> using options ${warningConfOptions.mkString(" ")}
525+
|object WConfExample extends App {
526+
| @deprecated("This method will be removed", "1.0.0")
527+
| def oldMethod(): Unit = println("This is an old method.")
528+
| oldMethod()
529+
|}
530+
|""".stripMargin).fromRoot { root =>
531+
val localCache = root / "local-cache"
532+
val localBin = root / "local-bin"
533+
os.proc(
534+
TestUtil.cs,
535+
"install",
536+
"--cache",
537+
localCache,
538+
"--install-dir",
539+
localBin,
540+
s"scalac:$sv"
541+
).call(cwd = root)
542+
val cliRes = os.proc(TestUtil.cli, "compile", sourceFileName, "--server=false")
543+
.call(cwd = root, check = false, stderr = os.Pipe)
544+
val scalacRes = os.proc(localBin / "scalac", warningConfOptions, sourceFileName)
545+
.call(cwd = root, check = false, stderr = os.Pipe)
546+
expect(scalacRes.exitCode == cliRes.exitCode)
547+
expect(scalacRes.err.trim() == cliRes.err.trim())
548+
}
549+
}
550+
518551
for {
519552
sv <- Seq(Constants.scala212, Constants.scala213, Constants.scala3NextRc)
520553
code =

modules/options/src/main/scala/scala/build/options/ScalacOpt.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ object ScalacOpt {
1818
private val repeatingKeys = Set(
1919
"-Xplugin",
2020
"-P", // plugin options
21-
"-language"
21+
"-language",
22+
"-Wconf"
2223
)
2324

2425
implicit val hashedType: HashedType[ScalacOpt] = {

0 commit comments

Comments
 (0)