Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/contracts/fromStdlib/isNullOrEmpty.kt
T
Dmitry Savvinov d4d7946e6a Effects: add diagnostic tests on functions from stdlib
==========
Introduction of EffectSystem: 18/18
2017-10-12 11:55:26 +03:00

21 lines
410 B
Kotlin
Vendored

// !LANGUAGE: +ReturnsEffect
// !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER
fun testIsNullOrEmpty(x: String?) {
if (x.isNullOrEmpty()) {
x<!UNSAFE_CALL!>.<!>length
}
else {
<!DEBUG_INFO_SMARTCAST!>x<!>.length
}
}
fun testIsNotNullOrEmpty(x: String?) {
if (!x.isNullOrEmpty()) {
<!DEBUG_INFO_SMARTCAST!>x<!>.length
}
x<!UNSAFE_CALL!>.<!>length
}