@@ -246,10 +246,9 @@ object Tuple:
246
246
* constant `true`. A predicate `P[X]` is a type that can be either `true`
247
247
* or `false`. For example:
248
248
* ```scala
249
- * type IsString[x] <: Boolean = x match {
249
+ * type IsString[x] <: Boolean = x match
250
250
* case String => true
251
251
* case _ => false
252
- * }
253
252
* summon[Tuple.Filter[(1, "foo", 2, "bar"), IsString] =:= ("foo", "bar")]
254
253
* ```
255
254
* @syntax markdown
@@ -325,26 +324,21 @@ object Tuple:
325
324
fromArray(xs, xs.length)
326
325
327
326
/** Convert the first `n` elements of an array into a tuple of unknown arity and types */
328
- def fromArray [T ](xs : Array [T ], n : Int ): Tuple = {
329
- val xs2 = xs match {
327
+ def fromArray [T ](xs : Array [T ], n : Int ): Tuple =
328
+ val xs2 = xs match
330
329
case xs : Array [Object ] => xs
331
330
case xs => xs.map(_.asInstanceOf [Object ])
332
- }
333
331
runtime.Tuples .fromArray(xs2, n)
334
- }
335
332
336
333
/** Convert an immutable array into a tuple of unknown arity and types */
337
334
def fromIArray [T ](xs : IArray [T ]): Tuple = fromIArray(xs, xs.length)
338
335
339
336
/** Convert the first `n` elements of an immutable array into a tuple of unknown arity and types */
340
- def fromIArray [T ](xs : IArray [T ], n : Int ): Tuple = {
341
- val xs2 : IArray [Object ] = xs match {
337
+ def fromIArray [T ](xs : IArray [T ], n : Int ): Tuple =
338
+ val xs2 : IArray [Object ] = xs match
342
339
case xs : IArray [Object ] @ unchecked => xs
343
- case _ =>
344
- xs.map(_.asInstanceOf [Object ])
345
- }
340
+ case _ => xs.map(_.asInstanceOf [Object ])
346
341
runtime.Tuples .fromIArray(xs2, n)
347
- }
348
342
349
343
/** Convert a Product into a tuple of unknown arity and types */
350
344
def fromProduct (product : Product ): Tuple =
@@ -394,16 +388,14 @@ end Tuple
394
388
type EmptyTuple = EmptyTuple .type
395
389
396
390
/** A tuple of 0 elements. */
397
- case object EmptyTuple extends Tuple {
391
+ case object EmptyTuple extends Tuple :
398
392
override def toString (): String = " ()"
399
- }
400
393
401
394
/** Tuple of arbitrary non-zero arity */
402
395
sealed trait NonEmptyTuple extends Tuple
403
396
404
397
@ showAsInfix
405
398
sealed abstract class *: [+ H , + T <: Tuple ] extends NonEmptyTuple
406
399
407
- object *: {
400
+ object `*:` :
408
401
def unapply [H , T <: Tuple ](x : H *: T ): (H , T ) = (x.head, x.tail)
409
- }
0 commit comments