Files
kotlin-fork/compiler/testData/codegen/box/elvis/genericElvisWithMoreSpecificLHS.kt
T
2020-11-09 16:04:43 +03:00

20 lines
421 B
Kotlin
Vendored

// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: STDLIB_COLLECTIONS
// !LANGUAGE: +NewInference
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
fun test(foo: MutableList<String>?): List<String> {
val bar = foo ?: listOf()
return bar
}
fun box(): String {
val a = test(null)
if (a.isNotEmpty()) return "Fail 1"
val b = test(mutableListOf("a"))
if (b.size != 1) return "Fail 2"
return "OK"
}