Skip to content

Commit 85420c3

Browse files
Combine cases of Tuple.Zip disjoint from (h1 *: t1, h2 *: t2)
If we reach the second case of `Zip[T1 <: Tuple, T2 <: Tuple]`, then we know `(T1, T2)` is disjoint from `(NonEmptyTuple, NonEmptyTuple)`, from which we can conclude at least one of the two is an `EmptyTuple`. Addressing #19175
1 parent 7f141a9 commit 85420c3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Diff for: library/src/scala/Tuple.scala

+3-6
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,12 @@ object Tuple {
175175
}
176176

177177
/** Given two tuples, `A1 *: ... *: An * At` and `B1 *: ... *: Bn *: Bt`
178-
* where at least one of `At` or `Bt` is `EmptyTuple` or `Tuple`,
179-
* returns the tuple type `(A1, B1) *: ... *: (An, Bn) *: Ct`
180-
* where `Ct` is `EmptyTuple` if `At` or `Bt` is `EmptyTuple`, otherwise `Ct` is `Tuple`.
178+
* where at least one of `At` or `Bt` is `EmptyTuple`,
179+
* returns the tuple type `(A1, B1) *: ... *: (An, Bn) *: EmptyTuple`.
181180
*/
182181
type Zip[T1 <: Tuple, T2 <: Tuple] <: Tuple = (T1, T2) match {
183182
case (h1 *: t1, h2 *: t2) => (h1, h2) *: Zip[t1, t2]
184-
case (EmptyTuple, _) => EmptyTuple
185-
case (_, EmptyTuple) => EmptyTuple
186-
case _ => Tuple
183+
case _ => EmptyTuple
187184
}
188185

189186
/** Converts a tuple `(F[T1], ..., F[Tn])` to `(T1, ... Tn)` */

0 commit comments

Comments
 (0)