Hmm, I don't understand why use of ```infix fun &l...
# kotest
m
Hmm, I don't understand why use of
Copy code
infix fun <B> Either<Any?, B>.shouldBeRight(b: B) = this should beRight(b)
is compiling with whatever type of B that is not compatible with the Either's B type...?
s
Wouldn't type inference just promote B to be the least common bound of the eithers right type and whatever vale you passed into the function
m
What would they have in common then? B is given by the receiver type?
Maybe because it is defined as
sealed class Either<out A, out B>
?
Here the two B-s were a primitive type and class type, so they should not be compatible at all....
s
They would have Any in common
m
Hm japp. Anything that could be done to avoid that compiling as it will never work at runtime?
s
There is an experimental annotation we could try
🙌 1