Ayfri
08/08/2022, 4:51 PMdmitriy.novozhilov
08/08/2022, 6:24 PMAyfri
08/08/2022, 6:26 PMwhen
?dmitriy.novozhilov
08/08/2022, 6:35 PMwhen
expressions are nothing more than select
function from inference point of view
when {
... -> x
... -> y
... -> z
}
// same as
fun <K> select(vararg value: K): K
select(x, y, z)
Boolean & String
is an intersection type, not unioninterface A
interface B
interface C : A, B
interface D : A, B
fun test(c: C, d: D) {
val x = select(c, d)
// type of x is CommonSuperType(C, D) = A & B
}
Ayfri
08/09/2022, 5:37 AM