@@ -11,9 +11,15 @@ sealed trait Tuple extends Product {
11
11
inline def toArray : Array [Object ] =
12
12
runtime.Tuples .toArray(this )
13
13
14
+ // NOTE: Replaced by `toList` extension method in the `Tuple` object.
15
+ // Kept this version of the method as `private[scala]` to be
16
+ // able to unpickle older TASTy files.
17
+ // TODO: When we can break TASTy compat, replace this method with one that has the following signature
18
+ // `inline def toList[This >: this.type <: Tuple]: List[Union[This]]`
19
+ // and remove the extension method in the `Tuple` object.
14
20
/** Create a copy this tuple as a List */
15
- inline def toList [ This >: this . type <: Tuple ] : List [Union [This ]] =
16
- this .productIterator.toList.asInstanceOf [List [Union [This ]]]
21
+ private [scala] inline def toList : List [Union [this . type ]] =
22
+ this .productIterator.toList.asInstanceOf [List [Union [this . type ]]]
17
23
18
24
/** Create a copy this tuple as an IArray */
19
25
inline def toIArray : IArray [Object ] =
@@ -231,6 +237,13 @@ object Tuple {
231
237
232
238
def fromProductTyped [P <: Product ](p : P )(using m : scala.deriving.Mirror .ProductOf [P ]): m.MirroredElemTypes =
233
239
runtime.Tuples .fromProduct(p).asInstanceOf [m.MirroredElemTypes ]
240
+
241
+ // TODO: When we can break TASTy compat, move this method to `Tuple` class and use the following signature
242
+ // `inline def toList[This >: this.type <: Tuple]: List[Union[This]]`
243
+ /** Create a copy this tuple as a List */
244
+ extension [This <: Tuple ](inline tuple : This )
245
+ inline def toList : List [Union [This ]] =
246
+ tuple.productIterator.toList.asInstanceOf [List [Union [This ]]]
234
247
}
235
248
236
249
/** A tuple of 0 elements */
0 commit comments