We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a570e24 commit e32eb2dCopy full SHA for e32eb2d
compiler/src/dotty/tools/dotc/config/Settings.scala
@@ -65,6 +65,8 @@ object Settings {
65
depends: List[(Setting[_], Any)] = Nil,
66
propertyClass: Option[Class[_]] = None)(private[Settings] val idx: Int) {
67
68
+ private var changed: Boolean = false
69
+
70
def withAbbreviation(abbrv: String): Setting[T] =
71
copy(aliases = aliases :+ abbrv)(idx)
72
@@ -111,8 +113,14 @@ object Settings {
111
113
112
114
def tryToSet(state: ArgsSummary): ArgsSummary = {
115
val ArgsSummary(sstate, arg :: args, errors, warnings) = state
- def update(value: Any, args: List[String]) =
- ArgsSummary(updateIn(sstate, value), args, errors, warnings)
116
+ def update(value: Any, args: List[String]) = {
117
+ if (changed) {
118
+ fail(s"Flag $name set repeatedly", args)
119
+ } else {
120
+ changed = true
121
+ ArgsSummary(updateIn(sstate, value), args, errors, warnings)
122
+ }
123
124
def fail(msg: String, args: List[String]) =
125
ArgsSummary(sstate, args, errors :+ msg, warnings)
126
def missingArg =
0 commit comments