AJ Alt
10/15/2018, 10:24 PM@ExperimentalContracts
is transitive, forcing callers to opt-in even if they don't declare any contracts themselves.
Is there a way to get this to compile?
@ExperimentalContracts inline fun <T> foo(block: () -> T): T {
contract { callsInPlace(block, EXACTLY_ONCE) }
return block()
}
fun main() {
foo { } // error: this declaration is experimental and its usage must be marked with '@ExperimentalContracts'
}
Mike
10/15/2018, 11:29 PMAJ Alt
10/16/2018, 12:01 AMMike
10/16/2018, 12:58 AMilya.gorbunov
10/16/2018, 1:13 AM@UseExperimental(ExperimentalContracts::class)
annotation.
More about it in the experimental annotations KEEP: https://github.com/Kotlin/KEEP/blob/master/proposals/experimental.mdAJ Alt
10/16/2018, 3:40 PM