Skip to content

Commit 42ac960

Browse files
committed
Make Tuple.Map/FlatMap pass bounds checks
Similar to how TupleMap, in pos/9890, had to deal with the bounds check of the head, and how inserts, in pos/10867, had to deal with the Tuple.Map functor argument.
1 parent a1eb832 commit 42ac960

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/src/scala/Tuple.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ object Tuple {
140140
/** Converts a tuple `(T1, ..., Tn)` to `(F[T1], ..., F[Tn])` */
141141
type Map[Tup <: Tuple, F[_ <: Union[Tup]]] <: Tuple = Tup match {
142142
case EmptyTuple => EmptyTuple
143-
case h *: t => F[h] *: Map[t, F]
143+
case h *: t => F[h & Union[Tup]] *: Map[t, [x <: Union[t]] =>> F[x & Union[Tup]]]
144144
}
145145

146146
/** Converts a tuple `(T1, ..., Tn)` to a flattened `(..F[T1], ..., ..F[Tn])` */
147147
type FlatMap[Tup <: Tuple, F[_ <: Union[Tup]] <: Tuple] <: Tuple = Tup match {
148148
case EmptyTuple => EmptyTuple
149-
case h *: t => Concat[F[h], FlatMap[t, F]]
149+
case h *: t => Concat[F[h & Union[Tup]], FlatMap[t, [x <: Union[t]] =>> F[x & Union[Tup]]]]
150150
}
151151

152152
/** Filters out those members of the tuple for which the predicate `P` returns `false`.

0 commit comments

Comments
 (0)