@@ -177,6 +177,7 @@ object DynamicTuple {
177
177
}
178
178
}).asInstanceOf [T ]
179
179
180
+ // Cons for Tuple1 to Tuple22
180
181
def specialCaseCons [H , This <: Tuple ](x : H , self : This ): H *: This = {
181
182
val res = (self : Any ) match {
182
183
case self : Unit =>
@@ -239,6 +240,7 @@ object DynamicTuple {
239
240
res.asInstanceOf [H *: This ]
240
241
}
241
242
243
+ // Cons for TupleXXL
242
244
def xxlCons [H , This <: Tuple ](x : H , xxl : TupleXXL ): H *: This = {
243
245
val arr = new Array [Object ](xxl.productArity + 1 )
244
246
System .arraycopy(xxl.elems, 0 , arr, 1 , xxl.productArity)
@@ -254,7 +256,7 @@ object DynamicTuple {
254
256
def dynamicConcat [This <: Tuple , That <: Tuple ](self : This , that : That ): Concat [This , That ] = {
255
257
type Result = Concat [This , That ]
256
258
257
- // If either of the tuple is empty, we can leave early
259
+ // If one of the tuples is empty, we can leave early
258
260
(self : Any ) match {
259
261
case self : Unit => return that.asInstanceOf [Result ]
260
262
case _ =>
@@ -267,6 +269,7 @@ object DynamicTuple {
267
269
268
270
val arr = new Array [Object ](self.size + that.size)
269
271
272
+ // Copies the tuple to an array, at the given offset
270
273
inline def copyToArray [T <: Tuple ](tuple : T , array : Array [Object ], offset : Int ): Unit = (tuple : Any ) match {
271
274
case xxl : TupleXXL =>
272
275
System .arraycopy(xxl.elems, 0 , array, offset, tuple.size)
@@ -275,6 +278,7 @@ object DynamicTuple {
275
278
.copyToArray(array, offset, tuple.size)
276
279
}
277
280
281
+ // In the general case, we copy the two tuples to an array, and convert it back to a tuple
278
282
copyToArray(self, arr, 0 )
279
283
copyToArray(that, arr, self.size)
280
284
dynamicFromIArray[Result ](arr.asInstanceOf [IArray [Object ]])
@@ -285,6 +289,7 @@ object DynamicTuple {
285
289
case self : Product => self.productArity.asInstanceOf [Size [This ]]
286
290
}
287
291
292
+ // Tail for Tuple1 to Tuple22
288
293
def specialCaseTail [This <: NonEmptyTuple ] (self : This ): Tail [This ] = {
289
294
val res = (self : Any ) match {
290
295
case self : Tuple1 [_] =>
@@ -335,6 +340,7 @@ object DynamicTuple {
335
340
res.asInstanceOf [Tail [This ]]
336
341
}
337
342
343
+ // Tail for TupleXXL
338
344
def xxlTail [This <: NonEmptyTuple ](xxl : TupleXXL ): Tail [This ] = {
339
345
if (xxl.productArity == 23 ) {
340
346
val elems = xxl.elems
@@ -388,6 +394,7 @@ object DynamicTuple {
388
394
).asInstanceOf [Zip [This , T2 ]]
389
395
}
390
396
397
+ // Map for Tuple1 to Tuple22
391
398
def specialCaseMap [This <: Tuple , F [_]](self : This , f : [t] => t => F [t]): Map [This , F ] = {
392
399
type Result = Map [This , F ]
393
400
val res = (self : Any ) match {
0 commit comments