File tree 1 file changed +8
-1
lines changed 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -154,6 +154,9 @@ final class main(maxLineLength: Int) extends MainAnnotation:
154
154
argIdx += 1
155
155
result
156
156
157
+ private def nameIsValid (name : String ): Boolean =
158
+ name.length > 0 // TODO add more checks for illegal characters
159
+
157
160
private def shortNameIsValid (shortName : Char ): Boolean =
158
161
// If you change this, remember to update the error message when an invalid short name is given
159
162
('A' <= shortName && shortName <= 'Z' ) || ('a' <= shortName && shortName <= 'z' )
@@ -264,7 +267,11 @@ final class main(maxLineLength: Int) extends MainAnnotation:
264
267
(indices ++: indicesShort).filter(_ >= 0 )
265
268
266
269
private def getAlternativeNames (paramInfos : ParameterInfos [_]): Seq [String ] =
267
- paramInfos.annotations.collect{ case annot : Name => annot.name }.filter(_.length > 0 )
270
+ val (valid, invalid) =
271
+ paramInfos.annotations.collect{ case annot : Name => annot.name }.partition(nameIsValid)
272
+ if invalid.nonEmpty then
273
+ throw IllegalArgumentException (s " invalid names ${invalid.mkString(" , " )} for parameter ${paramInfos.name}" )
274
+ valid
268
275
269
276
private def getShortNames (paramInfos : ParameterInfos [_]): Seq [Char ] =
270
277
val (valid, invalid) =
You can’t perform that action at this time.
0 commit comments