blob: 28caf4c00085f327af7f815137588d2ce7e4552f [file] [log] [blame]
// WITH_STDLIB
package js
fun test(x: List<Int>?) {
// If the function returns false, the value is definitely not null:
if (!x.isNullOrEmpty()) {
println(x.size) // Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type List<Int>?
}
}
fun test(x: Any?) {
// If the function returns (does not throw), then the argument is true:
require(x is String)
println(x.length) // Unresolved reference: length
}