Skip to content

Commit 208944b

Browse files
committed
Make Tuple types covariant
1 parent 66d34d9 commit 208944b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

library/src-scala3/scala/Tuple.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,25 +98,25 @@ object Tuple {
9898
transparent val $MaxSpecialized = 22
9999
transparent private val XXL = $MaxSpecialized + 1
100100

101-
type Head[X <: NonEmptyTuple] = X match {
101+
type Head[+X <: NonEmptyTuple] = X match {
102102
case x *: _ => x
103103
}
104104

105-
type Tail[X <: NonEmptyTuple] <: Tuple = X match {
105+
type Tail[+X <: NonEmptyTuple] <: Tuple = X match {
106106
case _ *: xs => xs
107107
}
108108

109-
type Concat[X <: Tuple, Y <: Tuple] <: Tuple = X match {
109+
type Concat[+X <: Tuple, +Y <: Tuple] <: Tuple = X match {
110110
case Unit => Y
111111
case x1 *: xs1 => x1 *: Concat[xs1, Y]
112112
}
113113

114-
type Elem[X <: Tuple, N] = (X, N) match {
114+
type Elem[+X <: Tuple, +N] = (X, N) match {
115115
case (x *: xs, 0) => x
116116
case (x *: xs, S[n1]) => Elem[xs, n1]
117117
}
118118

119-
type Size[X] <: Int = X match {
119+
type Size[+X] <: Int = X match {
120120
case Unit => 0
121121
case x *: xs => S[Size[xs]]
122122
}

0 commit comments

Comments
 (0)