@@ -11,27 +11,27 @@ sealed trait Tuple extends Any {
11
11
12
12
/** Create a copy this tuple as an Array */
13
13
inline def toArray : Array [Object ] =
14
- DynamicTuple .dynamicToArray (this )
14
+ DynamicTuple .toArray (this )
15
15
16
16
/** Create a copy this tuple as an IArray */
17
17
inline def toIArray : IArray [Object ] =
18
- DynamicTuple .dynamicToIArray (this )
18
+ DynamicTuple .toIArray (this )
19
19
20
20
/** Return a new tuple by prepending the element to `this` tuple.
21
21
* This opteration is O(this.size)
22
22
*/
23
23
inline def *: [H , This >: this .type <: Tuple ] (x : H ): H *: This =
24
- DynamicTuple .dynamicCons[ H , This ] (x, this )
24
+ DynamicTuple .cons (x, this ). asInstanceOf [ H *: This ]
25
25
26
26
/** Return a new tuple by concatenating `this` tuple with `that` tuple.
27
27
* This opteration is O(this.size + that.size)
28
28
*/
29
29
inline def ++ [This >: this .type <: Tuple ](that : Tuple ): Concat [This , that.type ] =
30
- DynamicTuple .dynamicConcat[ This , that.type ]( this , that)
30
+ DynamicTuple .concat( this , that). asInstanceOf [ Concat [ This , that.type ]]
31
31
32
32
/** Return the size (or arity) of the tuple */
33
33
inline def size [This >: this .type <: Tuple ]: Size [This ] =
34
- DynamicTuple .dynamicSize (this )
34
+ DynamicTuple .size (this ). asInstanceOf [ Size [ This ]]
35
35
36
36
/** Given two tuples, `(a1, ..., an)` and `(a1, ..., an)`, returns a tuple
37
37
* `((a1, b1), ..., (an, bn))`. If the two tuples have different sizes,
@@ -41,35 +41,35 @@ sealed trait Tuple extends Any {
41
41
* `(A1, B1) *: ... *: (Ai, Bi) *: Tuple`
42
42
*/
43
43
inline def zip [This >: this .type <: Tuple , T2 <: Tuple ](t2 : T2 ): Zip [This , T2 ] =
44
- DynamicTuple .dynamicZip (this , t2)
44
+ DynamicTuple .zip (this , t2). asInstanceOf [ Zip [ This , T2 ]]
45
45
46
46
/** Called on a tuple `(a1, ..., an)`, returns a new tuple `(f(a1), ..., f(an))`.
47
47
* The result is typed as `(F[A1], ..., F[An])` if the tuple type is fully known.
48
48
* If the tuple is of the form `a1 *: ... *: Tuple` (that is, the tail is not known
49
49
* to be the cons type.
50
50
*/
51
51
inline def map [F [_]](f : [t] => t => F [t]): Map [this .type , F ] =
52
- DynamicTuple .dynamicMap (this , f)
52
+ DynamicTuple .map (this , f). asInstanceOf [ Map [ this . type , F ]]
53
53
54
54
/** Given a tuple `(a1, ..., am)`, returns the tuple `(a1, ..., an)` consisting
55
55
* of its first n elements.
56
56
*/
57
57
inline def take [This >: this .type <: Tuple ](n : Int ): Take [This , n.type ] =
58
- DynamicTuple .dynamicTake[ This , n.type ]( this , n)
58
+ DynamicTuple .take( this , n). asInstanceOf [ Take [ This , n.type ]]
59
59
60
60
61
61
/** Given a tuple `(a1, ..., am)`, returns the tuple `(an+1, ..., am)` consisting
62
62
* all its elements except the first n ones.
63
63
*/
64
64
inline def drop [This >: this .type <: Tuple ](n : Int ): Drop [This , n.type ] =
65
- DynamicTuple .dynamicDrop[ This , n.type ]( this , n)
65
+ DynamicTuple .drop( this , n). asInstanceOf [ Drop [ This , n.type ]]
66
66
67
67
/** Given a tuple `(a1, ..., am)`, returns a pair of the tuple `(a1, ..., an)`
68
68
* consisting of the first n elements, and the tuple `(an+1, ..., am)` consisting
69
69
* of the remaining elements.
70
70
*/
71
71
inline def splitAt [This >: this .type <: Tuple ](n : Int ): Split [This , n.type ] =
72
- DynamicTuple .dynamicSplitAt[ This , n.type ]( this , n)
72
+ DynamicTuple .splitAt( this , n). asInstanceOf [ Split [ This , n.type ]]
73
73
}
74
74
75
75
object Tuple {
@@ -165,7 +165,7 @@ object Tuple {
165
165
case xs : Array [Object ] => xs
166
166
case xs => xs.map(_.asInstanceOf [Object ])
167
167
}
168
- DynamicTuple .dynamicFromArray[ Tuple ] (xs2)
168
+ DynamicTuple .fromArray (xs2). asInstanceOf [ Tuple ]
169
169
}
170
170
171
171
/** Convert an immutable array into a tuple of unknown arity and types */
@@ -176,12 +176,12 @@ object Tuple {
176
176
// TODO suport IArray.map
177
177
xs.asInstanceOf [Array [T ]].map(_.asInstanceOf [Object ]).asInstanceOf [IArray [Object ]]
178
178
}
179
- DynamicTuple .dynamicFromIArray[ Tuple ] (xs2)
179
+ DynamicTuple .fromIArray (xs2). asInstanceOf [ Tuple ]
180
180
}
181
181
182
182
/** Convert a Product into a tuple of unknown arity and types */
183
183
def fromProduct (product : Product ): Tuple =
184
- runtime.DynamicTuple .dynamicFromProduct[ Tuple ] (product)
184
+ runtime.DynamicTuple .fromProduct (product)
185
185
186
186
def fromProductTyped [P <: Product ](p : P )(using m : scala.deriving.Mirror .ProductOf [P ]): m.MirroredElemTypes =
187
187
Tuple .fromArray(p.productIterator.toArray).asInstanceOf [m.MirroredElemTypes ] // TODO use toIArray of Object to avoid double/triple array copy
@@ -195,17 +195,17 @@ sealed trait NonEmptyTuple extends Tuple {
195
195
* Equivalent to productElement but with a precise return type.
196
196
*/
197
197
inline def apply [This >: this .type <: NonEmptyTuple ](n : Int ): Elem [This , n.type ] =
198
- DynamicTuple .dynamicApply[ This , n.type ]( this , n)
198
+ DynamicTuple .apply( this , n). asInstanceOf [ Elem [ This , n.type ]]
199
199
200
200
/** Get the head of this tuple */
201
201
inline def head [This >: this .type <: NonEmptyTuple ]: Head [This ] =
202
- DynamicTuple .dynamicApply[ This , 0 ] (this , 0 )
202
+ DynamicTuple .apply (this , 0 ). asInstanceOf [ Head [ This ]]
203
203
204
204
/** Get the tail of this tuple.
205
205
* This opteration is O(this.size)
206
206
*/
207
207
inline def tail [This >: this .type <: NonEmptyTuple ]: Tail [This ] =
208
- DynamicTuple .dynamicTail[ This ] (this )
208
+ DynamicTuple .tail (this ). asInstanceOf [ Tail [ This ]]
209
209
210
210
}
211
211
0 commit comments