File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -350,13 +350,14 @@ object Tuple:
350
350
// Also note it would be unsound to use a type parameter for `y` in the type level
351
351
// operations, since they are rightfully not covariant in their second parameter.
352
352
353
- /** The index (starting at 0) of the first occurrence of y.type in the type `X` of `x`
354
- * or Size[X] if no such element exists.
353
+ /** The index (starting at 0) of the first occurrence of `y` in `x`
354
+ * or its size if no such element exists.
355
355
*/
356
356
inline def indexOf (y : Any ): IndexOf [X , y.type ] =
357
- x.productIterator.indexOf(y).asInstanceOf [IndexOf [X , y.type ]]
357
+ val i = x.productIterator.indexOf(y)
358
+ (if i >= 0 then i else x.size).asInstanceOf [IndexOf [X , y.type ]]
358
359
359
- /** A boolean indicating whether there is an element `y.type` in the type `X` of `x ` */
360
+ /** A boolean indicating whether `x` contains the element `y ` */
360
361
inline def contains (y : Any ): Contains [X , y.type ] =
361
362
x.productIterator.contains(y).asInstanceOf [Contains [X , y.type ]]
362
363
You can’t perform that action at this time.
0 commit comments