@@ -49,7 +49,7 @@ sealed trait Tuple extends Any {
49
49
val t = asInstanceOf [Tuple4 [_, _, _, _]]
50
50
Tuple5 (x, t._1, t._2, t._3, t._4).asInstanceOf [Result ]
51
51
case Some (n) =>
52
- knownTupleFromItrator[H *: this .type ](Iterator .single(x) ++ this .asInstanceOf [Product ].productIterator)
52
+ knownTupleFromItrator[H *: this .type ](n + 1 , Iterator .single(x) ++ this .asInstanceOf [Product ].productIterator)
53
53
case _ =>
54
54
DynamicTuple .dynamic_*: [This , H ](this , x)
55
55
}
@@ -73,8 +73,8 @@ sealed trait Tuple extends Any {
73
73
case 2 =>
74
74
val u = that.asInstanceOf [Tuple2 [_, _]]
75
75
Tuple4 (t._1, t._2, u._1, u._2).asInstanceOf [Result ]
76
- case _ =>
77
- knownTupleFromItrator[Result ](this .asInstanceOf [Product ].productIterator ++ that.asInstanceOf [Product ].productIterator)
76
+ case m =>
77
+ knownTupleFromItrator[Result ](2 + m, this .asInstanceOf [Product ].productIterator ++ that.asInstanceOf [Product ].productIterator)
78
78
}
79
79
case Some (3 ) =>
80
80
val t = asInstanceOf [Tuple3 [_, _, _]]
@@ -83,12 +83,14 @@ sealed trait Tuple extends Any {
83
83
case 1 =>
84
84
val u = that.asInstanceOf [Tuple1 [_]]
85
85
Tuple4 (t._1, t._2, t._3, u._1).asInstanceOf [Result ]
86
- case _ =>
87
- knownTupleFromItrator[Result ](this .asInstanceOf [Product ].productIterator ++ that.asInstanceOf [Product ].productIterator)
86
+ case m =>
87
+ knownTupleFromItrator[Result ](3 + m, this .asInstanceOf [Product ].productIterator ++ that.asInstanceOf [Product ].productIterator)
88
88
}
89
- case Some (_) =>
90
- if (constValue[BoundedSize [that.type ]] == 0 ) this .asInstanceOf [Result ]
91
- else knownTupleFromItrator[Result ](this .asInstanceOf [Product ].productIterator ++ that.asInstanceOf [Product ].productIterator)
89
+ case Some (n) =>
90
+ inline constValue[BoundedSize [that.type ]] match {
91
+ case 0 => this .asInstanceOf [Result ]
92
+ case m => knownTupleFromItrator[Result ](n + m, this .asInstanceOf [Product ].productIterator ++ that.asInstanceOf [Product ].productIterator)
93
+ }
92
94
case None =>
93
95
DynamicTuple .dynamic_++ [This , that.type ](this , that)
94
96
}
@@ -141,10 +143,10 @@ object Tuple {
141
143
}
142
144
}
143
145
144
- private [scala] type BoundedSize [X ] = BoundedSizeRecur [X , 23 ]
146
+ private [scala] type BoundedSize [X ] = BoundedSizeRecur [X , 24 ]
145
147
146
- private [scala] inline def knownTupleFromItrator [T <: Tuple ](it : Iterator [Any ]): T =
147
- inline constValue[ BoundedSize [ T ]] match {
148
+ private [scala] inline def knownTupleFromItrator [T <: Tuple ](n : Int , it : Iterator [Any ]): T =
149
+ inline n match {
148
150
case 0 => ().asInstanceOf [T ]
149
151
case 1 => Tuple1 (it.next()).asInstanceOf [T ]
150
152
case 2 => Tuple2 (it.next(), it.next()).asInstanceOf [T ]
@@ -233,7 +235,7 @@ sealed trait NonEmptyTuple extends Tuple {
233
235
case Some (n) if n > 5 =>
234
236
val it = this .asInstanceOf [Product ].productIterator
235
237
it.next()
236
- knownTupleFromItrator[Result ](it)
238
+ knownTupleFromItrator[Result ](n - 1 , it)
237
239
case None =>
238
240
DynamicTuple .dynamicTail[This ](this )
239
241
}
0 commit comments