@@ -7,7 +7,7 @@ sealed trait Tuple extends Any {
7
7
import Tuple ._
8
8
9
9
inline def toArray : Array [Object ] =
10
- if (stageIt) stagedToArray
10
+ if (stageIt) toArrayStaged
11
11
else inline constValueOpt[BoundedSize [this .type ]] match {
12
12
case Some (0 ) =>
13
13
empty$Array
@@ -31,11 +31,11 @@ sealed trait Tuple extends Any {
31
31
dynamicToArray(this )
32
32
}
33
33
34
- inline def stagedToArray : Array [Object ] =
34
+ inline def toArrayStaged : Array [Object ] =
35
35
$ { StagedTuple .toArrayStaged(' this , constValueOpt[BoundedSize [this .type ]]) }
36
36
37
37
inline def *: [H , This >: this .type <: Tuple ] (x : H ): H *: This =
38
- if (stageIt) stagedCons [H ](x)
38
+ if (stageIt) consStaged [H ](x)
39
39
else {
40
40
type Result = H *: This
41
41
inline constValueOpt[BoundedSize [this .type ]] match {
@@ -59,11 +59,11 @@ sealed trait Tuple extends Any {
59
59
}
60
60
}
61
61
62
- inline def stagedCons [H ] (x : H ): H *: this .type =
63
- $ { StagedTuple .stagedCons (' this , ' x , constValueOpt[BoundedSize [this .type ]]) }
62
+ inline def consStaged [H ] (x : H ): H *: this .type =
63
+ $ { StagedTuple .consStaged (' this , ' x , constValueOpt[BoundedSize [this .type ]]) }
64
64
65
65
inline def ++ [This >: this .type <: Tuple ](that : Tuple ): Concat [This , that.type ] =
66
- if (stageIt) stagedConcat (that).asInstanceOf
66
+ if (stageIt) concatStaged (that).asInstanceOf
67
67
else {
68
68
type Result = Concat [This , that.type ]
69
69
inline constValueOpt[BoundedSize [this .type ]] match {
@@ -103,15 +103,15 @@ sealed trait Tuple extends Any {
103
103
}
104
104
}
105
105
106
- inline def stagedConcat (that : Tuple ): Concat [this .type , that.type ] =
107
- $ { StagedTuple .stagedConcat (' this , constValueOpt[BoundedSize [this .type ]],
106
+ inline def concatStaged (that : Tuple ): Concat [this .type , that.type ] =
107
+ $ { StagedTuple .concatStaged (' this , constValueOpt[BoundedSize [this .type ]],
108
108
' that , constValueOpt[BoundedSize [that.type ]]) }
109
109
110
110
inline def genericConcat [T <: Tuple ](xs : Tuple , ys : Tuple ): Tuple =
111
111
fromArray[T ](xs.toArray ++ ys.toArray)
112
112
113
113
inline def size [This >: this .type <: Tuple ]: Size [This ] =
114
- if (stageIt) stagedSize .asInstanceOf
114
+ if (stageIt) sizeStaged .asInstanceOf
115
115
else {
116
116
type Result = Size [This ]
117
117
inline constValueOpt[BoundedSize [this .type ]] match {
@@ -120,15 +120,15 @@ sealed trait Tuple extends Any {
120
120
}
121
121
}
122
122
123
- inline def stagedSize : Size [this .type ] =
123
+ inline def sizeStaged : Size [this .type ] =
124
124
$ { StagedTuple .sizeStaged[Size [this .type ]](' this , constValueOpt[BoundedSize [this .type ]]) }
125
125
}
126
126
127
127
object Tuple {
128
128
inline val MaxSpecialized = 22
129
129
inline private val XXL = MaxSpecialized + 1
130
130
131
- final val stageIt = false
131
+ final val stageIt = true
132
132
133
133
type Head [X <: NonEmptyTuple ] = X match {
134
134
case x *: _ => x
@@ -188,7 +188,7 @@ object Tuple {
188
188
}
189
189
190
190
inline def fromArray [T <: Tuple ](xs : Array [Object ]): T =
191
- if (stageIt) stagedFromArray [T ](xs)
191
+ if (stageIt) fromArrayStaged [T ](xs)
192
192
else inline constValue[BoundedSize [T ]] match {
193
193
case 0 => ().asInstanceOf [T ]
194
194
case 1 => Tuple1 (xs(0 )).asInstanceOf [T ]
@@ -216,7 +216,7 @@ object Tuple {
216
216
case _ => TupleXXL (xs).asInstanceOf [T ]
217
217
}
218
218
219
- inline def stagedFromArray [T <: Tuple ](xs : Array [Object ]): T =
219
+ inline def fromArrayStaged [T <: Tuple ](xs : Array [Object ]): T =
220
220
$ { StagedTuple .fromArrayStaged[T ](' xs , constValueOpt[BoundedSize [this .type ]]) }
221
221
222
222
def dynamicFromArray [T <: Tuple ](xs : Array [Object ]): T = xs.length match {
@@ -312,7 +312,7 @@ sealed trait NonEmptyTuple extends Tuple {
312
312
import NonEmptyTuple ._
313
313
314
314
inline def head [This >: this .type <: NonEmptyTuple ]: Head [This ] =
315
- if (stageIt) stagedHead .asInstanceOf
315
+ if (stageIt) headStaged .asInstanceOf
316
316
else {
317
317
type Result = Head [This ]
318
318
val resVal = inline constValueOpt[BoundedSize [this .type ]] match {
@@ -339,11 +339,11 @@ sealed trait NonEmptyTuple extends Tuple {
339
339
resVal.asInstanceOf [Result ]
340
340
}
341
341
342
- inline def stagedHead : Head [this .type ] =
342
+ inline def headStaged : Head [this .type ] =
343
343
$ { StagedTuple .headStaged[this .type ](' this , constValueOpt[BoundedSize [this .type ]]) }
344
344
345
345
inline def tail [This >: this .type <: NonEmptyTuple ]: Tail [This ] =
346
- if (stageIt) stagedTail .asInstanceOf
346
+ if (stageIt) tailStaged .asInstanceOf
347
347
else {
348
348
type Result = Tail [This ]
349
349
inline constValueOpt[BoundedSize [this .type ]] match {
@@ -368,7 +368,7 @@ sealed trait NonEmptyTuple extends Tuple {
368
368
}
369
369
}
370
370
371
- inline def stagedTail : Tail [this .type ] =
371
+ inline def tailStaged : Tail [this .type ] =
372
372
$ { StagedTuple .tailStaged[this .type ](' this , constValueOpt[BoundedSize [this .type ]]) }
373
373
374
374
inline def fallbackApply (n : Int ) =
@@ -378,7 +378,7 @@ sealed trait NonEmptyTuple extends Tuple {
378
378
}
379
379
380
380
inline def apply [This >: this .type <: NonEmptyTuple ](n : Int ): Elem [This , n.type ] =
381
- if (stageIt) stagedApply (n).asInstanceOf
381
+ if (stageIt) applyStaged (n).asInstanceOf
382
382
else {
383
383
type Result = Elem [This , n.type ]
384
384
inline constValueOpt[Size [this .type ]] match {
@@ -428,7 +428,7 @@ sealed trait NonEmptyTuple extends Tuple {
428
428
}
429
429
}
430
430
431
- inline def stagedApply (n : Int ): Elem [this .type , n.type ] =
431
+ inline def applyStaged (n : Int ): Elem [this .type , n.type ] =
432
432
$ { StagedTuple .applyStaged[this .type , n.type ](
433
433
' this , constValueOpt[Size [this .type ]],
434
434
' n , constValueOpt[n.type ]) }
@@ -476,5 +476,6 @@ object NonEmptyTuple {
476
476
sealed class *: [+ H , + T <: Tuple ] extends NonEmptyTuple
477
477
478
478
object *: {
479
- inline def unapply [H , T <: Tuple ](x : H *: T ) = (x.head, x.tail)
479
+ inline def unapply [H , T <: Tuple ](x : H *: T ) =
480
+ (NonEmptyTuple .dynamicHead(x), NonEmptyTuple .dynamicTail(x))
480
481
}
0 commit comments