You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Type argument TBox does not conform to upper bound [_$4] =>> Any
val tt: Tuple.Map[(EmptyTuple, EmptyTuple), TBox] = (TBox(EmptyTuple), TBox(EmptyTuple))
Expectation
Since the first line of the main function and the snippet below work, I expected the above to work too.
The second parameter of Tuple.Map is F[_], meaning that one has to pass a type lambda that can be applied to any type parameter, this isn't the case of TBox which requires its type parameter to be a subtype of Tuple, hence the error message. It looks like this is fixable by changing that second parameter type to be upper-bounded by Union[Tup] instead:
objectTest {
typeMap[Tup<:Tuple, F[_ <:Tuple.Union[Tup]]] <:Tuple=Tupmatch {
caseEmptyTuple=>EmptyTuplecase h *: t =>F[h] *:Map[t, F]
}
caseclassTBox[A<:Tuple](v: A)
valtt:Map[(EmptyTuple, EmptyTuple), TBox] = (TBox(EmptyTuple), TBox(EmptyTuple)) // now OK
}
The same change might be applicable to other match types in Tuple too /cc @nicolasstucki
Compiler version
3.0.0-RC3
Minimized code
Output
Expectation
Since the first line of the main function and the snippet below work, I expected the above to work too.
The text was updated successfully, but these errors were encountered: