Can anyone tell me what is wrong with this?
# getting-started
l
Can anyone tell me what is wrong with this?
c
hard to say without seeing the code. at a glance: the “required” type is nullable, the “found” type is not.
l
Yeah but should that really be a problem? I own the required type, making it non nullable doesnt solve it
image.png
This doesnt make sense to me
making "Any" non nullable doesnt change anything
This works, oddly enough
m
arrayOf(arrayOf(1))
isn't compiling as expected in your code unless you specify the exact same type
Array<Array<Any?>>
explicitly because the type parameter of Array in Kotlin is invariant, it is actually declared as
Array<T>
not
Array<out T>
, the latter is equivalent to Array<? extends T> Source: https://github.com/JetBrains/kotlin/blob/ea836fd46a1fef07d77c96f9d7e8d7807f793453/core/builtins/native/kotlin/Array.kt#L15
👍 1