Ryan Smith
04/06/2023, 6:33 PMPreconditions.kt
as part of the implementation of check{,NotNull}
and require{,NotNull}
et al.
Today I discovered I can write similar blocks in my own code like this as long as I opt-in for `@ExperimentalContracts`:
fun checkSomeType(value: SomeSuperType) {
contract {
returns() implies (value is SomeType)
}
check(value is SomeType) {
"error"
}
}
My question is multi-faceted. Has the contracts API always been "experimental"? If so, what's left for it to become "stable" given how long it's been around? If not, is it marked "experimental" because it's becoming part of the public standard library API?ephemient
04/06/2023, 6:39 PMRyan Smith
04/06/2023, 6:42 PMdmitriy.novozhilov
04/06/2023, 7:29 PMRyan Smith
04/06/2023, 7:35 PMdmitriy.novozhilov
04/06/2023, 9:14 PMYoussef Shoaib [MOD]
04/07/2023, 3:21 AMContractBuilder
a context, and thus remove the need to add the label to this
in returns() implies (this@myFun is X)
dmitriy.novozhilov
04/07/2023, 7:42 AMthis
is solved in new syntax