[FIR-TEST] Add new testdata generated after changes in previous commit
This commit is contained in:
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect
|
||||
// !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 || this.length == 0
|
||||
}
|
||||
|
||||
fun smartcastOnReceiver(s: String?) {
|
||||
with(s) {
|
||||
if (isNullOrEmpty()) {
|
||||
length
|
||||
}
|
||||
else {
|
||||
length
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun mixedReceiver(s: String?) {
|
||||
if (!s.isNullOrEmpty()) {
|
||||
with(s) {
|
||||
length
|
||||
}
|
||||
} else {
|
||||
with(s) {
|
||||
length
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user