Skip to content

Commit b8a10a4

Browse files
EugeneFlesselleWojciechMazur
authored andcommitted
Add an infix shorthand for Tuple.Concat
Addressing #19175 [Cherry-picked 4e47edf]
1 parent d4904a7 commit b8a10a4

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
@@ -58,8 +58,8 @@ sealed trait Tuple extends Product {
5858
/** Return a new tuple by concatenating `this` tuple with `that` tuple.
5959
* This operation is O(this.size + that.size)
6060
*/
61-
inline def ++ [This >: this.type <: Tuple](that: Tuple): Concat[This, that.type] =
62-
runtime.Tuples.concat(this, that).asInstanceOf[Concat[This, that.type]]
61+
inline def ++ [This >: this.type <: Tuple](that: Tuple): This ++ that.type =
62+
runtime.Tuples.concat(this, that).asInstanceOf[This ++ that.type]
6363

6464
/** Return the size (or arity) of the tuple */
6565
inline def size[This >: this.type <: Tuple]: Size[This] =
@@ -150,6 +150,9 @@ object Tuple {
150150
case x1 *: xs1 => x1 *: Concat[xs1, Y]
151151
}
152152

153+
/** An infix shorthand for `Concat[X, Y]` */
154+
infix type ++[X <: Tuple, +Y <: Tuple] = Concat[X, Y]
155+
153156
/** Type of the element at position N in the tuple X */
154157
type Elem[X <: Tuple, N <: Int] = X match {
155158
case x *: xs =>

0 commit comments

Comments
 (0)