<Intersection Type Compatibility Problem With Java...
# forum
r
Intersection Type Compatibility Problem With Java I can currently do something like this in java: private static T thing(){ return (T) ""; } and just use it val stuff=thing(); variable stuff gets a type hint of Comparable & CharSequence Doing the equivalent in Kotlin doesn’t work fun thing():T where T:CharSequence, T:Comparable{ return "" as T } fun main() { val stuff= thing() // ERROR, cannot infer type T } if I call it with thing() then things work...