Skip to content

Commit 1c78e14

Browse files
committed
Ensure the following scalac options do not require being passed after -O: -color, -feature, -deprecation and -nowarn
1 parent 9110ed6 commit 1c78e14

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

modules/cli-options/src/main/scala/scala/cli/commands/ScalacOptions.scala

+6-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ object ScalacOptions {
3434
Set("-V", "-W", "-X", "-Y")
3535
private val scalacOptionsPrefixes =
3636
Set("-g", "-language", "-opt", "-P", "-target") ++ scalacOptionsPurePrefixes
37-
private val scalacAliasedOptions = // these options don't require being passed after -O
38-
Set("-encoding", "-release")
37+
private val scalacAliasedOptions = // these options don't require being passed after -O and accept an arg
38+
Set("-encoding", "-release", "-color")
39+
private val scalacNoArgAliasedOptions = // these options don't require being passed after -O and don't accept an arg
40+
Set("-nowarn", "-feature", "-deprecation")
3941

4042
/** This includes all the scalac options which disregard inputs and print a help and/or context
4143
* message instead.
@@ -67,6 +69,8 @@ object ScalacOptions {
6769
args match {
6870
case h :: t if scalacOptionsPrefixes.exists(h.startsWith) =>
6971
Right(Some((Some(h :: acc.getOrElse(Nil)), t)))
72+
case h :: t if scalacNoArgAliasedOptions.contains(h) =>
73+
Right(Some((Some(h :: acc.getOrElse(Nil)), t)))
7074
case h :: t if scalacAliasedOptions.contains(h) =>
7175
// check if the next scalac arg is a different option or a param to the current option
7276
val maybeOptionArg = t.headOption.filter(!_.startsWith("-"))

0 commit comments

Comments
 (0)