Skip to content

Commit c3e6832

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

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

Lines changed: 6 additions & 2 deletions
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.
@@ -75,6 +77,8 @@ object ScalacOptions {
7577
args match {
7678
case h :: t if scalacOptionsPrefixes.exists(h.startsWith) =>
7779
Right(Some((Some(h :: acc.getOrElse(Nil)), t)))
80+
case h :: t if scalacNoArgAliasedOptions.contains(h) =>
81+
Right(Some((Some(h :: acc.getOrElse(Nil)), t)))
7882
case h :: t if scalacAliasedOptions.contains(h) =>
7983
val maybeOptionArg = t.headOption.filter(!_.startsWith("-"))
8084
val newTail = maybeOptionArg.map(_ => t.drop(1)).getOrElse(t)

0 commit comments

Comments
 (0)