[FIR] Add test cases to prove resolution of backlog tickets
^KT-41728 Fixed ^KT-46586 Fixed ^KT-49696 Fixed ^KT-51160 Fixed ^KT-53308 Fixed
This commit is contained in:
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-46586
|
||||
|
||||
inline fun run(block: () -> Unit) = block()
|
||||
|
||||
fun test() {
|
||||
var label: String? = null
|
||||
run {
|
||||
label = "zzz"
|
||||
}
|
||||
if (label == null) {
|
||||
label = "zzz"
|
||||
}
|
||||
label.isBlank()
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-46586
|
||||
|
||||
inline fun run(block: () -> Unit) = block()
|
||||
|
||||
fun test() {
|
||||
var label: String? = null
|
||||
run {
|
||||
label = "zzz"
|
||||
}
|
||||
if (label == null) {
|
||||
label = "zzz"
|
||||
}
|
||||
<!SMARTCAST_IMPOSSIBLE!>label<!>.isBlank()
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// !OPT_IN: kotlin.contracts.ExperimentalContracts
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-53308
|
||||
|
||||
import kotlin.contracts.*
|
||||
|
||||
fun <E> checkEquality(arg: E?) { contract { returns() implies (arg != null) } }
|
||||
fun <E> checkIdentity(arg: E?) { contract { <!ERROR_IN_CONTRACT_DESCRIPTION("NOT_IDENTITY operator call is illegal in contract description")!>returns() implies (arg !== null)<!> } }
|
||||
fun checkTrue(statement: Boolean) { contract { returns() implies statement } }
|
||||
fun checkFalse(statement: Boolean) { contract { returns() implies !statement } }
|
||||
|
||||
fun consume(arg: String) {}
|
||||
|
||||
fun test(a: String?) {
|
||||
a.let {
|
||||
checkEquality(it)
|
||||
consume(it)
|
||||
}
|
||||
a.let {
|
||||
checkIdentity(it)
|
||||
consume(<!ARGUMENT_TYPE_MISMATCH!>it<!>)
|
||||
}
|
||||
a.let {
|
||||
checkTrue(it != null)
|
||||
consume(it)
|
||||
}
|
||||
a.let {
|
||||
checkTrue(it !== null)
|
||||
consume(it)
|
||||
}
|
||||
a.let {
|
||||
checkFalse(it == null)
|
||||
consume(it)
|
||||
}
|
||||
a.let {
|
||||
checkFalse(it === null)
|
||||
consume(it)
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
// !OPT_IN: kotlin.contracts.ExperimentalContracts
|
||||
// WITH_STDLIB
|
||||
// ISSUE: KT-53308
|
||||
|
||||
import kotlin.contracts.*
|
||||
|
||||
fun <E> checkEquality(arg: E?) { contract { returns() implies (arg != null) } }
|
||||
fun <E> checkIdentity(arg: E?) { contract { returns() implies (arg !== null) } }
|
||||
fun checkTrue(statement: Boolean) { contract { returns() implies statement } }
|
||||
fun checkFalse(statement: Boolean) { contract { returns() implies !statement } }
|
||||
|
||||
fun consume(arg: String) {}
|
||||
|
||||
fun test(a: String?) {
|
||||
a.let {
|
||||
checkEquality(it)
|
||||
consume(<!DEBUG_INFO_SMARTCAST!>it<!>)
|
||||
}
|
||||
a.let {
|
||||
checkIdentity(it)
|
||||
consume(<!DEBUG_INFO_SMARTCAST!>it<!>)
|
||||
}
|
||||
a.let {
|
||||
checkTrue(it != null)
|
||||
consume(<!DEBUG_INFO_SMARTCAST!>it<!>)
|
||||
}
|
||||
a.let {
|
||||
checkTrue(it !== null)
|
||||
consume(<!TYPE_MISMATCH!>it<!>)
|
||||
}
|
||||
a.let {
|
||||
checkFalse(it == null)
|
||||
consume(<!DEBUG_INFO_SMARTCAST!>it<!>)
|
||||
}
|
||||
a.let {
|
||||
checkFalse(it === null)
|
||||
consume(<!TYPE_MISMATCH!>it<!>)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user