Skip to content
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
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/config/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ object Settings:
val output = if (isJar) JarArchive.create(path) else new PlainDirectory(path)
update(output, args)
}
case (IntTag, arg2 :: args2) =>
case (IntTag, _) =>
val arg2 :: args2 = if (argRest == "") args else argRest :: args
try {
val x = arg2.toInt
choices match {
Expand Down
12 changes: 12 additions & 0 deletions compiler/test/dotty/tools/dotc/SettingsTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@ class SettingsTests {
assertEquals(expectedErrors, summary.errors)
}

@Test def `Allow IntSetting's to be set with a colon`: Unit =
object Settings extends SettingGroup:
val foo = IntSetting("-foo", "foo", 80)
import Settings._

val args = List("-foo:100")
val summary = processArguments(args, processAll = true)
assertTrue(s"Setting args errors:\n ${summary.errors.take(5).mkString("\n ")}", summary.errors.isEmpty)
withProcessedArgs(summary) {
assertEquals(100, foo.value)
}

private def withProcessedArgs(summary: ArgsSummary)(f: SettingsState ?=> Unit) = f(using summary.sstate)

extension [T](setting: Setting[T])
Expand Down