Skip to content

Commit 6b0f163

Browse files
committed
Use lists directly
1 parent 033aa34 commit 6b0f163

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

compiler/src/dotty/tools/dotc/transform/localopt/StringContextChecker.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ object StringContextChecker {
361361
* @param notAllowedFlagsOnCondition a list that maps which flags are allowed depending on the conversion Char
362362
* @return reports an error if the flag is not allowed, nothing otherwise
363363
*/
364-
def checkFlags(partIndex : Int, flags : List[(Char, Int)], notAllowedFlagOnCondition : (Char, Boolean, String)*) = {
364+
def checkFlags(partIndex : Int, flags : List[(Char, Int)], notAllowedFlagOnCondition: List[(Char, Boolean, String)]) = {
365365
for {flag <- flags ; (nonAllowedFlag, condition, message) <- notAllowedFlagOnCondition ; if (flag._1 == nonAllowedFlag && condition)}
366366
reporter.partError(message, partIndex, flag._2)
367367
}
@@ -373,7 +373,7 @@ object StringContextChecker {
373373
* @param notAllowedFlagsOnCondition a list that maps which flags are allowed depending on the conversion Char
374374
* @return reports an error only once if at least one of the flags is not allowed, nothing otherwise
375375
*/
376-
def checkUniqueFlags(partIndex : Int, flags : List[(Char, Int)], notAllowedFlagOnCondition : (Char, Boolean, String)*) = {
376+
def checkUniqueFlags(partIndex : Int, flags : List[(Char, Int)], notAllowedFlagOnCondition : List[(Char, Boolean, String)]) = {
377377
reporter.resetReported()
378378
for {flag <- flags ; (nonAllowedFlag, condition, message) <- notAllowedFlagOnCondition ; if (flag._1 == nonAllowedFlag && condition)} {
379379
if (!reporter.hasReported())
@@ -394,7 +394,7 @@ object StringContextChecker {
394394
*/
395395
def checkCharacterConversion(partIndex : Int, flags : List[(Char, Int)], hasPrecision : Boolean, precisionIndex : Int) = {
396396
val notAllowedFlagOnCondition = for (flag <- List('#', '+', ' ', '0', ',', '(')) yield (flag, true, "Only '-' allowed for c conversion")
397-
checkUniqueFlags(partIndex, flags, notAllowedFlagOnCondition : _*)
397+
checkUniqueFlags(partIndex, flags, notAllowedFlagOnCondition)
398398
checkNotAllowedParameter(hasPrecision, partIndex, precisionIndex, "precision")
399399
}
400400

@@ -413,7 +413,7 @@ object StringContextChecker {
413413
*/
414414
def checkIntegralConversion(partIndex : Int, argType : Option[Type], conversionChar : Char, flags : List[(Char, Int)], hasPrecision : Boolean, precision : Int) = {
415415
if (conversionChar == 'd')
416-
checkFlags(partIndex, flags, ('#', true, "# not allowed for d conversion"))
416+
checkFlags(partIndex, flags, List(('#', true, "# not allowed for d conversion")))
417417

418418
checkNotAllowedParameter(hasPrecision, partIndex, precision, "precision")
419419
}
@@ -471,7 +471,7 @@ object StringContextChecker {
471471
}
472472

473473
val notAllowedFlagOnCondition = for (flag <- List('#', '+', ' ', '0', ',', '(')) yield (flag, true, "Only '-' allowed for date/time conversions")
474-
checkUniqueFlags(partIndex, flags, notAllowedFlagOnCondition : _*)
474+
checkUniqueFlags(partIndex, flags, notAllowedFlagOnCondition)
475475
checkNotAllowedParameter(hasPrecision, partIndex, precision, "precision")
476476
checkTime(part, partIndex, conversionIndex)
477477
}
@@ -506,12 +506,12 @@ object StringContextChecker {
506506
checkNotAllowedParameter(hasPrecision, partIndex, precision, "precision")
507507
checkNotAllowedParameter(hasWidth, partIndex, width, "width")
508508
val notAllowedFlagOnCondition = for (flag <- List('-', '#', '+', ' ', '0', ',', '(')) yield (flag, true, "flags not allowed")
509-
checkUniqueFlags(partIndex, flags, notAllowedFlagOnCondition : _*)
509+
checkUniqueFlags(partIndex, flags, notAllowedFlagOnCondition)
510510
}
511511
case '%' => {
512512
checkNotAllowedParameter(hasPrecision, partIndex, precision, "precision")
513513
val notAllowedFlagOnCondition = for (flag <- List('#', '+', ' ', '0', ',', '(')) yield (flag, true, "Illegal flag '" + flag + "'")
514-
checkFlags(partIndex, flags, notAllowedFlagOnCondition : _*)
514+
checkFlags(partIndex, flags, notAllowedFlagOnCondition)
515515
}
516516
case _ => // OK
517517
}
@@ -600,7 +600,7 @@ object StringContextChecker {
600600
(' ', !(argType <:< defn.JavaBigIntegerClass.typeRef), "only use ' ' for BigInt conversions to o, x, X"),
601601
('(', !(argType <:< defn.JavaBigIntegerClass.typeRef), "only use '(' for BigInt conversions to o, x, X"),
602602
(',', true, "',' only allowed for d conversion of integral types"))
603-
checkFlags(partIndex, flags, notAllowedFlagOnCondition : _*)
603+
checkFlags(partIndex, flags, notAllowedFlagOnCondition)
604604
}
605605
}
606606
case 'e' | 'E' |'f' | 'g' | 'G' | 'a' | 'A' => checkSubtype(argType, "Double", argIndex, floatingPoints)
@@ -631,7 +631,7 @@ object StringContextChecker {
631631
(' ', true, "only use ' ' for BigInt conversions to o, x, X"),
632632
('(', true, "only use '(' for BigInt conversions to o, x, X"),
633633
(',', true, "',' only allowed for d conversion of integral types"))
634-
checkFlags(partIndex, flags, notAllowedFlagOnCondition : _*)
634+
checkFlags(partIndex, flags, notAllowedFlagOnCondition)
635635
}
636636
case _ => //OK
637637
}

0 commit comments

Comments
 (0)