Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure consecutive -Wconf:* flags are not ignored #3245

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,39 @@ class SipScalaTests extends ScalaCliSuite with SbtTestHelper with MillTestHelper
}
}

test("consecutive -Wconf:* flags are not ignored") {
val sv = "3.5.2"
val sourceFileName = "example.scala"
val warningConfOptions = Seq("-Wconf:cat=deprecation:e", "-Wconf:any:s")
Gedochao marked this conversation as resolved.
Show resolved Hide resolved
TestInputs(os.rel / sourceFileName ->
s"""//> using scala $sv
|//> using options ${warningConfOptions.mkString(" ")}
Gedochao marked this conversation as resolved.
Show resolved Hide resolved
|object WConfExample extends App {
| @deprecated("This method will be removed", "1.0.0")
| def oldMethod(): Unit = println("This is an old method.")
| oldMethod()
|}
|""".stripMargin).fromRoot { root =>
val localCache = root / "local-cache"
val localBin = root / "local-bin"
os.proc(
TestUtil.cs,
"install",
"--cache",
localCache,
"--install-dir",
localBin,
s"scalac:$sv"
).call(cwd = root)
val cliRes = os.proc(TestUtil.cli, "compile", sourceFileName, "--server=false")
.call(cwd = root, check = false, stderr = os.Pipe)
val scalacRes = os.proc(localBin / "scalac", warningConfOptions, sourceFileName)
.call(cwd = root, check = false, stderr = os.Pipe)
expect(scalacRes.exitCode == cliRes.exitCode)
expect(scalacRes.err.trim() == cliRes.err.trim())
}
}

for {
sv <- Seq(Constants.scala212, Constants.scala213, Constants.scala3NextRc)
code =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ object ScalacOpt {
private val repeatingKeys = Set(
"-Xplugin",
"-P", // plugin options
"-language"
"-language",
"-Wconf"
Gedochao marked this conversation as resolved.
Show resolved Hide resolved
)

implicit val hashedType: HashedType[ScalacOpt] = {
Expand Down
Loading