Skip to content

Prevent consecutive -language:* options from being ignored #2667

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

Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -495,4 +495,23 @@ class SipScalaTests extends ScalaCliSuite {
expect(res.exitCode == 0)
}
}

test("consecutive -language:* flags are not ignored") {
val sourceFileName = "example.scala"
TestInputs(os.rel / sourceFileName ->
"""//> using scala 3.3.1
|//> using options -Yexplicit-nulls -language:fewerBraces -language:strictEquality
|def repro[A](as: List[A]): List[A] =
| as match
| case Nil => Nil
| case _ => ???
|""".stripMargin).fromRoot { root =>
val res = os.proc(TestUtil.cli, "compile", sourceFileName)
.call(cwd = root, check = false, stderr = os.Pipe)
expect(res.exitCode == 1)
val expectedError =
"Values of types object scala.collection.immutable.Nil and List[A] cannot be compared with == or !="
expect(res.err.trim().contains(expectedError))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ final case class ScalacOpt(value: String) {
object ScalacOpt {
private val repeatingKeys = Set(
"-Xplugin:",
"-P" // plugin options
"-P", // plugin options
"-language:"
)

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