Skip to content

Commit 4e47edf

Browse files
Add an infix shorthand for Tuple.Concat
Addressing #19175
1 parent 74349e8 commit 4e47edf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

library/src/scala/Tuple.scala

+5-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ sealed trait Tuple extends Product {
3434
/** Return a new tuple by concatenating `this` tuple with `that` tuple.
3535
* This operation is O(this.size + that.size)
3636
*/
37-
inline def ++ [This >: this.type <: Tuple](that: Tuple): Concat[This, that.type] =
38-
runtime.Tuples.concat(this, that).asInstanceOf[Concat[This, that.type]]
37+
inline def ++ [This >: this.type <: Tuple](that: Tuple): This ++ that.type =
38+
runtime.Tuples.concat(this, that).asInstanceOf[This ++ that.type]
3939

4040
/** Return the size (or arity) of the tuple */
4141
inline def size[This >: this.type <: Tuple]: Size[This] =
@@ -126,6 +126,9 @@ object Tuple {
126126
case x1 *: xs1 => x1 *: Concat[xs1, Y]
127127
}
128128

129+
/** An infix shorthand for `Concat[X, Y]` */
130+
infix type ++[X <: Tuple, +Y <: Tuple] = Concat[X, Y]
131+
129132
/** Type of the element at position N in the tuple X */
130133
type Elem[X <: Tuple, N <: Int] = X match {
131134
case x *: xs =>

0 commit comments

Comments
 (0)