Lukellmann
01/30/2022, 1:46 PMfoo of b: Base<*> to null? I understand why it can't be set to any list but don't get why null shouldn't be allowed.
abstract class Base<T> {
// foo is nullable
final var foo: MutableList<T>? = mutableListOf()
}
class Inherit : Base<String>()
val a = Inherit()
a.foo = null // works
a.foo = mutableListOf() // works
val b: Any = if (Random.nextBoolean()) a else Any()
if (b is Base<*>) {
// error: 'Setter for 'foo' is removed by type projection'
// I understand why it can't be set to any list but `null` should always be ok
b.foo = null
}dmitriy.novozhilov
01/30/2022, 6:05 PMLukellmann
01/30/2022, 10:34 PM