[kotlinp] Split :tools:kotlinp into "common" and "jvm" subprojects
The "common" subproject keeps only backend-neutral logic and depends only on :kotlinx-metadata library. It takes the name of the former project - :tools:kotlinp The "jvm" subproject depends on the "common" one and also depends on :kotlinx-metadata-jvm. It gets the new name - :tools:kotlinp-jvm There is a lot of touched files in this commit. The majority of them is just moved files (tests, test data, etc). Only the following files were actually modified: .space/CODEOWNERS build.gradle.kts libraries/tools/abi-comparator/build.gradle.kts libraries/tools/kotlinp/build.gradle.kts libraries/tools/kotlinp/jvm/build.gradle.kts plugins/kapt3/kapt3-compiler/build.gradle.kts settings.gradle ^KT-62340
This commit is contained in:
committed by
Space Team
parent
eec76865a7
commit
d30efdb001
@@ -0,0 +1,66 @@
|
||||
@file:OptIn(ExperimentalContracts::class)
|
||||
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
|
||||
fun returnsTrue(condition: Boolean) {
|
||||
contract {
|
||||
returns(true) implies (condition)
|
||||
}
|
||||
}
|
||||
|
||||
fun returnsNull(condition: Boolean) {
|
||||
contract {
|
||||
returns(null) implies (condition)
|
||||
}
|
||||
}
|
||||
|
||||
fun returnsNotNull(condition: Boolean) {
|
||||
contract {
|
||||
returnsNotNull() implies (condition)
|
||||
}
|
||||
}
|
||||
|
||||
fun Any?.receiverIsNotNull(): Boolean {
|
||||
contract {
|
||||
returns(true) implies (this@receiverIsNotNull != null)
|
||||
}
|
||||
return this != null
|
||||
}
|
||||
|
||||
inline fun callsInPlaceAtMostOnce(block: () -> Unit) {
|
||||
contract {
|
||||
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
|
||||
}
|
||||
}
|
||||
|
||||
inline fun callsInPlaceUnknown(block: () -> Unit) {
|
||||
contract {
|
||||
callsInPlace(block, InvocationKind.UNKNOWN)
|
||||
}
|
||||
}
|
||||
|
||||
fun conjunction(a: Boolean, b: Boolean, c: Boolean) {
|
||||
contract {
|
||||
returns() implies (a && !b && c)
|
||||
}
|
||||
}
|
||||
|
||||
fun disjunction(a: Boolean, b: Boolean, c: Boolean) {
|
||||
contract {
|
||||
returns() implies (a || !b || c)
|
||||
}
|
||||
}
|
||||
|
||||
fun complexBoolean(a: Any?, b: Any?, c: Any?, d: Any?) {
|
||||
contract {
|
||||
returns() implies ((a != null && c != null) || (b == null && d != null))
|
||||
}
|
||||
}
|
||||
|
||||
fun negatedIsAndConjunction(a: Any?, b: Boolean, c: Any?) {
|
||||
contract {
|
||||
returns() implies (a !is List<*> && b && c == null)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user