Trying out contracts in 1.3-M2 right now. The comp...
# eap
r
Trying out contracts in 1.3-M2 right now. The compiler seems to require that I only call functions that use contracts from functions that are also marked with the
@ExperimentalContracts
Annotation, so I have to effectively mark all my functions with that Annotation. Is that intended? From the blog it seems like you should only need that annotation on functions that actually specify a contract, not those that just call functions with contracts.
o
@dsavvinov
d
@robin experimentality is contagious (by default): if you use some experimental API (contracts, in this case), you become part of an experimental API too. There's a way to opt-in for experimentality without becoming experimental yourself: you have to use
@UseExperimental(kotlin.contacts.ExperimentalContracts::class)
r
That makes sense, thanks for the explanation! Didn't know there was a difference between the two ways to opt in.