Michael de Kaste
06/08/2023, 9:19 AMfun <T : Number> test(n1: T, n2: T){ ... }
is it possible to make this illegal (one is int, other is double):
test(3, 3.0)
but this should be legal (both are int)
test(3, 4)
Sam
06/08/2023, 9:24 AM@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")
fun <T : Number> test(n1: @kotlin.internal.Exact T, n2: @kotlin.internal.Exact T) { ... }
@Exact
annotation isn’t supposed to be accessible/usable by us mere mortals)Michael de Kaste
06/08/2023, 9:27 AMif(n1 is Int){
n2 // should now also be inferred to be Int but is still a T
}