Skip to content

Commit 47a3cbf

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` and `T2` are both disjoint from `NonEmptyTuple`. From which I believe we can conclude they are both subtypes of `EmptyTuple`. I went with `(EmptyTuple, EmptyTuple)` for the 2nd pattern, although I believe it should be equivalent to a wildcard pattern, for the same reason as described above.
1 parent 7a0230d commit 47a3cbf

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

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

+3-4
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,13 @@ 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`,
179178
* returns the tuple type `(A1, B1) *: ... *: (An, Bn) *: Ct`
180-
* where `Ct` is `EmptyTuple` if `At` or `Bt` is `EmptyTuple`, otherwise `Ct` is `Tuple`.
179+
* where `Ct` is `EmptyTuple` if `At` and `Bt` are `EmptyTuple`,
180+
* otherwise `Ct` is stuck as `Zip[At, Bt]`.
181181
*/
182182
type Zip[T1 <: Tuple, T2 <: Tuple] <: Tuple = (T1, T2) match {
183183
case (h1 *: t1, h2 *: t2) => (h1, h2) *: Zip[t1, t2]
184-
case (EmptyTuple, _) => EmptyTuple
185-
case (_, EmptyTuple) => EmptyTuple
184+
case (EmptyTuple, EmptyTuple) => EmptyTuple
186185
}
187186

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

0 commit comments

Comments
 (0)