<Unexpected type inference behaviour with definite...
# forum
r
Unexpected type inference behaviour with definitely not-nullable type parameters I’ll lead with the code: class MyOption(private var value: V?) { fun hasValue(): Boolean { return value == null } fun clear() { value = null } fun set(value: V) { this.value = value } fun get(): V { return value!! } } class SomeContainer(private val param: T) { fun hasValue(): MyOption { // return MyOption(param); // DOESN'T Work, compiler complains // works fine return if (param == null) {...