Move changes from dfb379d under new language feature (#KT-28672)
Changes from that commit are breaking, and should be pass throw LC
This commit is contained in:
+1
-1
@@ -20,7 +20,7 @@ fun smartcastOnReceiver(s: String?) {
|
||||
<!UNSAFE_CALL!>length<!>
|
||||
}
|
||||
else {
|
||||
<!DEBUG_INFO_IMPLICIT_RECEIVER_SMARTCAST!>length<!>
|
||||
<!UNSAFE_CALL!>length<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
// !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 {
|
||||
<!DEBUG_INFO_IMPLICIT_RECEIVER_SMARTCAST!>length<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun mixedReceiver(s: String?) {
|
||||
if (!s.isNullOrEmpty()) {
|
||||
with(<!DEBUG_INFO_SMARTCAST!>s<!>) {
|
||||
length
|
||||
}
|
||||
} else {
|
||||
with(s) {
|
||||
<!UNSAFE_CALL!>length<!>
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
package
|
||||
|
||||
public fun mixedReceiver(/*0*/ s: kotlin.String?): kotlin.Unit
|
||||
public fun smartcastOnReceiver(/*0*/ s: kotlin.String?): kotlin.Unit
|
||||
public fun kotlin.CharSequence?.isNullOrEmpty(): kotlin.Boolean
|
||||
Returns(FALSE) -> <this> != null
|
||||
Reference in New Issue
Block a user