@@ -94,7 +94,7 @@ sealed trait Tuple extends Product:
94
94
* for which the given type level predicate `P` reduces to the literal
95
95
* constant `true`.
96
96
*/
97
- inline def filter [This >: this .type <: Tuple , P [_] <: Boolean ]: Filter [This , P ] =
97
+ inline def filter [This >: this .type <: Tuple , P [_ <: Union [ This ] ] <: Boolean ]: Filter [This , P ] =
98
98
val toInclude = constValueTuple[IndicesWhere [This , P ]].toArray
99
99
val arr = new Array [Object ](toInclude.length)
100
100
for i <- 0 until toInclude.length do
@@ -216,7 +216,7 @@ object Tuple:
216
216
* ```
217
217
* @syntax markdown
218
218
*/
219
- type Filter [X <: Tuple , P [_] <: Boolean ] <: Tuple = X match
219
+ type Filter [X <: Tuple , P [_ <: Union [ X ] ] <: Boolean ] <: Tuple = X match
220
220
case EmptyTuple => EmptyTuple
221
221
case x *: xs => P [x] match
222
222
case true => x *: Filter [xs, P ]
@@ -225,7 +225,7 @@ object Tuple:
225
225
/** A tuple consisting of those indices `N` of tuple `X` where the predicate `P`
226
226
* is true for `Elem[X, N]`. Indices are type level values <: Int.
227
227
*/
228
- type IndicesWhere [X <: Tuple , P [_] <: Boolean ] =
228
+ type IndicesWhere [X <: Tuple , P [_ <: Union [ X ] ] <: Boolean ] =
229
229
helpers.IndicesWhereHelper [X , P , 0 ]
230
230
231
231
/** The type of the tuple consisting of all element values of
@@ -355,7 +355,7 @@ object Tuple:
355
355
private object helpers :
356
356
357
357
/** Used to implement IndicesWhere */
358
- type IndicesWhereHelper [X <: Tuple , P [_] <: Boolean , N <: Int ] <: Tuple = X match
358
+ type IndicesWhereHelper [X <: Tuple , P [_ <: Union [ X ] ] <: Boolean , N <: Int ] <: Tuple = X match
359
359
case EmptyTuple => EmptyTuple
360
360
case h *: t => P [h] match
361
361
case true => N *: IndicesWhereHelper [t, P , S [N ]]
0 commit comments