Skip to content

Commit 348a448

Browse files
author
Antoine Brunner
committed
Rebase and comment
1 parent 3cabf84 commit 348a448

File tree

3 files changed

+8
-79
lines changed

3 files changed

+8
-79
lines changed

bench-run/src/main/scala/tuples/Map.scala

Lines changed: 0 additions & 40 deletions
This file was deleted.

bench-run/src/main/scala/tuples/Zip.scala

Lines changed: 0 additions & 38 deletions
This file was deleted.

library/src/scala/runtime/DynamicTuple.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ object DynamicTuple {
177177
}
178178
}).asInstanceOf[T]
179179

180+
// Cons for Tuple1 to Tuple22
180181
def specialCaseCons[H, This <: Tuple](x: H, self: This): H *: This = {
181182
val res = (self: Any) match {
182183
case self: Unit =>
@@ -239,6 +240,7 @@ object DynamicTuple {
239240
res.asInstanceOf[H *: This]
240241
}
241242

243+
// Cons for TupleXXL
242244
def xxlCons[H, This <: Tuple](x: H, xxl: TupleXXL): H *: This = {
243245
val arr = new Array[Object](xxl.productArity + 1)
244246
System.arraycopy(xxl.elems, 0, arr, 1, xxl.productArity)
@@ -254,7 +256,7 @@ object DynamicTuple {
254256
def dynamicConcat[This <: Tuple, That <: Tuple](self: This, that: That): Concat[This, That] = {
255257
type Result = Concat[This, That]
256258

257-
// If either of the tuple is empty, we can leave early
259+
// If one of the tuples is empty, we can leave early
258260
(self: Any) match {
259261
case self: Unit => return that.asInstanceOf[Result]
260262
case _ =>
@@ -267,6 +269,7 @@ object DynamicTuple {
267269

268270
val arr = new Array[Object](self.size + that.size)
269271

272+
// Copies the tuple to an array, at the given offset
270273
inline def copyToArray[T <: Tuple](tuple: T, array: Array[Object], offset: Int): Unit = (tuple: Any) match {
271274
case xxl: TupleXXL =>
272275
System.arraycopy(xxl.elems, 0, array, offset, tuple.size)
@@ -275,6 +278,7 @@ object DynamicTuple {
275278
.copyToArray(array, offset, tuple.size)
276279
}
277280

281+
// In the general case, we copy the two tuples to an array, and convert it back to a tuple
278282
copyToArray(self, arr, 0)
279283
copyToArray(that, arr, self.size)
280284
dynamicFromIArray[Result](arr.asInstanceOf[IArray[Object]])
@@ -285,6 +289,7 @@ object DynamicTuple {
285289
case self: Product => self.productArity.asInstanceOf[Size[This]]
286290
}
287291

292+
// Tail for Tuple1 to Tuple22
288293
def specialCaseTail[This <: NonEmptyTuple] (self: This): Tail[This] = {
289294
val res = (self: Any) match {
290295
case self: Tuple1[_] =>
@@ -335,6 +340,7 @@ object DynamicTuple {
335340
res.asInstanceOf[Tail[This]]
336341
}
337342

343+
// Tail for TupleXXL
338344
def xxlTail[This <: NonEmptyTuple](xxl: TupleXXL): Tail[This] = {
339345
if (xxl.productArity == 23) {
340346
val elems = xxl.elems
@@ -388,6 +394,7 @@ object DynamicTuple {
388394
).asInstanceOf[Zip[This, T2]]
389395
}
390396

397+
// Map for Tuple1 to Tuple22
391398
def specialCaseMap[This <: Tuple, F[_]](self: This, f: [t] => t => F[t]): Map[This, F] = {
392399
type Result = Map[This, F]
393400
val res = (self: Any) match {

0 commit comments

Comments
 (0)