``` fun testWhenSyntaxDataProvider(): Array<...
# getting-started
s
Copy code
fun testWhenSyntaxDataProvider(): Array<Array<Any?>> {
        return arrayOf(
            arrayOf(null, null, 10),
            arrayOf(1, null, 10),
            arrayOf(null, 2, 20),
            arrayOf(10, 20, 30)
        )
    }
The above function is throwing below exception:
Kotlin: Type inference failed. Expected type mismatch: inferred type is Array<Array<out Any?>> but Array<Array<Any?>> was expected
How can I typecast Int to Any?
d
With the new type inference your code seems to work fine.
The old type inference needs a bit of help:
Copy code
fun testWhenSyntaxDataProvider(): Array<Array<Any?>> {
    return arrayOf<Array<Any?>>(
        arrayOf(null, null, 10),
        arrayOf(1, null, 10),
        arrayOf(null, 2, 20),
        arrayOf(10, 20, 30)
    )
}
💯 2
s
Thanks for your quick help.. 👍