[Tests] Update test data with error suppression warnings
#KT-61129 Fixed
This commit is contained in:
committed by
Space Team
parent
969c716c76
commit
5b9c35de2e
+3
-3
@@ -1,6 +1,6 @@
|
||||
import kotlin.contracts.*
|
||||
|
||||
@Suppress("OPT_IN_USAGE_ERROR", "OPT_IN_USAGE_FUTURE_ERROR")
|
||||
@Suppress(<!ERROR_SUPPRESSION!>"OPT_IN_USAGE_ERROR"<!>, "OPT_IN_USAGE_FUTURE_ERROR")
|
||||
inline fun atLeastOnce(block: () -> Unit) {
|
||||
contract {
|
||||
callsInPlace(block, InvocationKind.AT_LEAST_ONCE)
|
||||
@@ -8,7 +8,7 @@ inline fun atLeastOnce(block: () -> Unit) {
|
||||
block()
|
||||
}
|
||||
|
||||
@Suppress("OPT_IN_USAGE_ERROR", "OPT_IN_USAGE_FUTURE_ERROR")
|
||||
@Suppress(<!ERROR_SUPPRESSION!>"OPT_IN_USAGE_ERROR"<!>, "OPT_IN_USAGE_FUTURE_ERROR")
|
||||
inline fun atMostOnce(block: () -> Unit) {
|
||||
contract {
|
||||
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
|
||||
@@ -16,7 +16,7 @@ inline fun atMostOnce(block: () -> Unit) {
|
||||
block()
|
||||
}
|
||||
|
||||
@Suppress("OPT_IN_USAGE_ERROR", "OPT_IN_USAGE_FUTURE_ERROR")
|
||||
@Suppress(<!ERROR_SUPPRESSION!>"OPT_IN_USAGE_ERROR"<!>, "OPT_IN_USAGE_FUTURE_ERROR")
|
||||
inline fun exactlyOnce(block: () -> Unit) {
|
||||
contract {
|
||||
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import kotlin.contracts.*
|
||||
|
||||
@Suppress("OPT_IN_USAGE_ERROR", "OPT_IN_USAGE_FUTURE_ERROR")
|
||||
@Suppress(<!ERROR_SUPPRESSION!>"OPT_IN_USAGE_ERROR"<!>, "OPT_IN_USAGE_FUTURE_ERROR")
|
||||
fun foo(f1: () -> Unit, f2: () -> Unit) {
|
||||
contract {
|
||||
callsInPlace(f1, InvocationKind.EXACTLY_ONCE)
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import kotlin.contracts.*
|
||||
|
||||
@Suppress(<!ERROR_SUPPRESSION!>"OPT_IN_USAGE_ERROR"<!>, "OPT_IN_USAGE_FUTURE_ERROR")
|
||||
fun exactlyOnce(f: () -> Unit) {
|
||||
contract {
|
||||
callsInPlace(f, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
f()
|
||||
}
|
||||
|
||||
fun test() {
|
||||
var s: String? = ""
|
||||
if (s != null) {
|
||||
val block: () -> Unit
|
||||
exactlyOnce {
|
||||
block = { s = null }
|
||||
}
|
||||
block()
|
||||
<!SMARTCAST_IMPOSSIBLE!>s<!>.length
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
import kotlin.contracts.*
|
||||
|
||||
@Suppress("OPT_IN_USAGE_ERROR", "OPT_IN_USAGE_FUTURE_ERROR")
|
||||
|
||||
Reference in New Issue
Block a user