Skip to content

Commit e060784

Browse files
committed
Fix Tuple.toList return type
This method failed for any subtype of `Tuple`. It only worked for `Tuple` and `TupleN` as these define their own `toList`. Fixes scala#12721
1 parent 75556ad commit e060784

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

library/src/scala/Tuple.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ sealed trait Tuple extends Product {
1212
runtime.Tuples.toArray(this)
1313

1414
/** Create a copy this tuple as a List */
15-
inline def toList: List[Union[this.type]] =
16-
this.productIterator.toList
17-
.asInstanceOf[List[Union[this.type]]]
15+
inline def toList[This >: this.type <: Tuple]: List[Union[This]] =
16+
this.productIterator.toList.asInstanceOf[List[Union[This]]]
1817

1918
/** Create a copy this tuple as an IArray */
2019
inline def toIArray: IArray[Object] =

0 commit comments

Comments
 (0)