Files
kotlin-fork/compiler/testData/diagnostics/tests/controlFlowAnalysis/elvisNotProcessed.fir.kt
T
Denis.Zharkov 2ecba6ac39 Remove WITH_NEW_INFERENCE directive from all tests
This directive anyway does not make test run twice with OI, and with NI
It only once run the test with specific settings (// LANGUAGE)
and ignores irrelevant (OI or NI tags)
2021-05-25 13:28:26 +03:00

39 lines
802 B
Kotlin
Vendored

// See KT-8277
// NI_EXPECTED_FILE
val v = { true } <!USELESS_ELVIS!>?: ( { true } <!USELESS_ELVIS!>?:null!!<!> )<!>
val w = if (true) {
{ true }
}
else {
{ true } <!USELESS_ELVIS!>?: null!!<!>
}
val ww = if (true) {
{ true } <!USELESS_ELVIS!>?: null!!<!>
}
else if (true) {
{ true } <!USELESS_ELVIS!>?: null!!<!>
}
else {
null!!
}
val n = null ?: (null ?: { true })
fun l(): (() -> Boolean)? = null
val b = null ?: ( l() ?: false)
val bb = null ?: ( l() ?: null!!)
val bbb = null ?: ( l() <!USELESS_ELVIS_RIGHT_IS_NULL!>?: null<!>)
val bbbb = ( l() <!USELESS_ELVIS_RIGHT_IS_NULL!>?: null<!>) ?: ( l() <!USELESS_ELVIS_RIGHT_IS_NULL!>?: null<!>)
fun f(x : Long?): Long {
var a = x ?: (fun() {} <!USELESS_ELVIS!>?: fun() {}<!>)
return <!RETURN_TYPE_MISMATCH!>a<!>
}