Skip to content

Commit 41125b0

Browse files
committed
Add -language:* as a possible repeatable compiler option
1 parent 077dbad commit 41125b0

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

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

+19
Original file line numberDiff line numberDiff line change
@@ -495,4 +495,23 @@ class SipScalaTests extends ScalaCliSuite {
495495
expect(res.exitCode == 0)
496496
}
497497
}
498+
499+
test("consecutive -language:* flags are not ignored") {
500+
val sourceFileName = "example.scala"
501+
TestInputs(os.rel / sourceFileName ->
502+
"""//> using scala 3.3.1
503+
|//> using options -Yexplicit-nulls -language:fewerBraces -language:strictEquality
504+
|def repro[A](as: List[A]): List[A] =
505+
| as match
506+
| case Nil => Nil
507+
| case _ => ???
508+
|""".stripMargin).fromRoot { root =>
509+
val res = os.proc(TestUtil.cli, "compile", sourceFileName)
510+
.call(cwd = root, check = false, stderr = os.Pipe)
511+
expect(res.exitCode == 1)
512+
val expectedError =
513+
"Values of types object scala.collection.immutable.Nil and List[A] cannot be compared with == or !="
514+
expect(res.err.trim().contains(expectedError))
515+
}
516+
}
498517
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ final case class ScalacOpt(value: String) {
1515
object ScalacOpt {
1616
private val repeatingKeys = Set(
1717
"-Xplugin:",
18-
"-P" // plugin options
18+
"-P", // plugin options
19+
"-language:"
1920
)
2021

2122
implicit val hashedType: HashedType[ScalacOpt] = {

0 commit comments

Comments
 (0)