Allow contracts on final non-override members since 1.4

This commit is contained in:
Dmitriy Novozhilov
2019-12-26 11:53:27 +03:00
parent 5a9070b6da
commit f083edfac2
34 changed files with 682 additions and 45 deletions
@@ -0,0 +1,19 @@
// !LANGUAGE: +AllowContractsForCustomFunctions +ReadDeserializedContracts +AllowContractsForNonOverridableMembers
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
package test
import kotlin.contracts.*
class Foo {
fun <X, Y, Z, R> callsEffectWithKind(block: (X, Y, Z) -> R) {
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
}
fun returnsImplies(x: Boolean) {
contract { returns() implies (x) }
}
}
@@ -0,0 +1,11 @@
package test
public final class Foo {
/*primary*/ public constructor Foo()
public final fun </*0*/ X, /*1*/ Y, /*2*/ Z, /*3*/ R> callsEffectWithKind(/*0*/ block: (X, Y, Z) -> R): kotlin.Unit
CallsInPlace(block, EXACTLY_ONCE)
public final fun returnsImplies(/*0*/ x: kotlin.Boolean): kotlin.Unit
Returns(WILDCARD) -> x
}