Publish ContractsDsl
- Mark @ContractsDsl as @Experimental - Move Contracts DSL out from 'internal' package - Change visibility of ContractsDsl from 'internal' to 'public' ^KT-25274 Fixed ^KT-25495 Fixed
This commit is contained in:
committed by
Ilya Gorbunov
parent
208c3a51ab
commit
accbd07b2e
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package kotlin.internal.contracts
|
||||
|
||||
import kotlin.internal.ContractsDsl
|
||||
import kotlin.internal.InlineOnly
|
||||
|
||||
@ContractsDsl
|
||||
@SinceKotlin("1.2")
|
||||
internal interface ContractBuilder {
|
||||
@ContractsDsl fun returns(): Returns
|
||||
@ContractsDsl fun returns(value: Any?): Returns
|
||||
@ContractsDsl fun returnsNotNull(): ReturnsNotNull
|
||||
@ContractsDsl fun <R> callsInPlace(lambda: Function<R>, kind: InvocationKind = InvocationKind.UNKNOWN): CallsInPlace
|
||||
}
|
||||
|
||||
@ContractsDsl
|
||||
@SinceKotlin("1.2")
|
||||
internal enum class InvocationKind {
|
||||
@ContractsDsl AT_MOST_ONCE,
|
||||
@ContractsDsl AT_LEAST_ONCE,
|
||||
@ContractsDsl EXACTLY_ONCE,
|
||||
@ContractsDsl UNKNOWN
|
||||
}
|
||||
|
||||
@ContractsDsl
|
||||
@InlineOnly
|
||||
@SinceKotlin("1.2")
|
||||
internal inline fun contract(builder: ContractBuilder.() -> Unit) { }
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package kotlin.internal.contracts
|
||||
|
||||
import kotlin.internal.ContractsDsl
|
||||
|
||||
@ContractsDsl
|
||||
@SinceKotlin("1.2")
|
||||
internal interface Effect
|
||||
|
||||
@ContractsDsl
|
||||
@SinceKotlin("1.2")
|
||||
internal interface ConditionalEffect : Effect
|
||||
|
||||
@ContractsDsl
|
||||
@SinceKotlin("1.2")
|
||||
internal interface SimpleEffect {
|
||||
@ContractsDsl
|
||||
infix fun implies(booleanExpression: Boolean): ConditionalEffect
|
||||
}
|
||||
|
||||
|
||||
@ContractsDsl
|
||||
@SinceKotlin("1.2")
|
||||
internal interface Returns : SimpleEffect
|
||||
|
||||
@ContractsDsl
|
||||
@SinceKotlin("1.2")
|
||||
internal interface ReturnsNotNull : SimpleEffect
|
||||
|
||||
@ContractsDsl
|
||||
@SinceKotlin("1.2")
|
||||
internal interface CallsInPlace : SimpleEffect
|
||||
Reference in New Issue
Block a user