e6b5cb5216
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
39 lines
895 B
Kotlin
Vendored
39 lines
895 B
Kotlin
Vendored
// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect -ContractsOnCallsWithImplicitReceiver
|
|
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
|
// !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER
|
|
//
|
|
// ISSUE: KT-28672
|
|
|
|
import kotlin.contracts.*
|
|
|
|
fun CharSequence?.isNullOrEmpty(): Boolean {
|
|
contract {
|
|
returns(false) implies (this@isNullOrEmpty != null)
|
|
}
|
|
|
|
return this == null || <!DEBUG_INFO_SMARTCAST!>this<!>.length == 0
|
|
}
|
|
|
|
fun smartcastOnReceiver(s: String?) {
|
|
with(s) {
|
|
if (isNullOrEmpty()) {
|
|
<!UNSAFE_CALL!>length<!>
|
|
}
|
|
else {
|
|
<!UNSAFE_CALL!>length<!>
|
|
}
|
|
}
|
|
}
|
|
|
|
fun mixedReceiver(s: String?) {
|
|
if (!s.isNullOrEmpty()) {
|
|
with(<!DEBUG_INFO_SMARTCAST!>s<!>) {
|
|
length
|
|
}
|
|
} else {
|
|
with(s) {
|
|
<!UNSAFE_CALL!>length<!>
|
|
}
|
|
}
|
|
}
|