[Tests] Update test data with error suppression warnings
#KT-61129 Fixed
This commit is contained in:
committed by
Space Team
parent
969c716c76
commit
5b9c35de2e
+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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user