@@ -580,7 +580,6 @@ object messages {
580
580
}
581
581
}
582
582
583
-
584
583
case class ByNameParameterNotSupported ()(implicit ctx : Context )
585
584
extends Message (21 ) {
586
585
val kind = " Syntax"
@@ -729,4 +728,30 @@ object messages {
729
728
| - auxiliary constructors specify the implicit value
730
729
| """
731
730
}
731
+
732
+ case class IncorrectRepeatedParameterSyntax ()(implicit ctx : Context ) extends Message (27 ) {
733
+ val kind = " Syntax"
734
+ val msg = " '*' expected"
735
+ val explanation =
736
+ hl """ |Expected * in '_*' operator.
737
+ |
738
+ |The '_*' operator can be used to supply a sequence-based argument
739
+ |to a method with a variable-length or repeated parameter. It is used
740
+ |to expand the sequence to a variable number of arguments, such that:
741
+ |func(args: _*) would expand to func(arg1, arg2 ... argN).
742
+ |
743
+ |Below is an example of how a method with a variable-length
744
+ |parameter can be declared and used.
745
+ |
746
+ |Squares the arguments of a variable-length parameter:
747
+ | ${" def square(args: Int*) = args.map(a => a * a)" }
748
+ |
749
+ |Usage:
750
+ | ${" square(1, 2, 3) // res0: List[Int] = List(1, 4, 9)" }
751
+ |
752
+ |Secondary Usage with '_*':
753
+ | ${" val ints = List(2, 3, 4) // ints: List[Int] = List(2, 3, 4)" }
754
+ | ${" square(ints: _*) // res1: List[Int] = List(4, 9, 16)" }
755
+ | """ .stripMargin
756
+ }
732
757
}
0 commit comments