@@ -49,7 +49,7 @@ sealed trait Tuple extends Any {
4949 val t = asInstanceOf [Tuple4 [_, _, _, _]]
5050 Tuple5 (x, t._1, t._2, t._3, t._4).asInstanceOf [Result ]
5151 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)
5353 case _ =>
5454 DynamicTuple .dynamic_*: [This , H ](this , x)
5555 }
@@ -73,8 +73,8 @@ sealed trait Tuple extends Any {
7373 case 2 =>
7474 val u = that.asInstanceOf [Tuple2 [_, _]]
7575 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)
7878 }
7979 case Some (3 ) =>
8080 val t = asInstanceOf [Tuple3 [_, _, _]]
@@ -83,12 +83,14 @@ sealed trait Tuple extends Any {
8383 case 1 =>
8484 val u = that.asInstanceOf [Tuple1 [_]]
8585 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)
8888 }
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+ }
9294 case None =>
9395 DynamicTuple .dynamic_++ [This , that.type ](this , that)
9496 }
@@ -141,10 +143,10 @@ object Tuple {
141143 }
142144 }
143145
144- private [scala] type BoundedSize [X ] = BoundedSizeRecur [X , 23 ]
146+ private [scala] type BoundedSize [X ] = BoundedSizeRecur [X , 24 ]
145147
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 {
148150 case 0 => ().asInstanceOf [T ]
149151 case 1 => Tuple1 (it.next()).asInstanceOf [T ]
150152 case 2 => Tuple2 (it.next(), it.next()).asInstanceOf [T ]
@@ -233,7 +235,7 @@ sealed trait NonEmptyTuple extends Tuple {
233235 case Some (n) if n > 5 =>
234236 val it = this .asInstanceOf [Product ].productIterator
235237 it.next()
236- knownTupleFromItrator[Result ](it)
238+ knownTupleFromItrator[Result ](n - 1 , it)
237239 case None =>
238240 DynamicTuple .dynamicTail[This ](this )
239241 }
0 commit comments