Move requireOrDescribe to :core:compiler.common

This commit is contained in:
Dmitriy Novozhilov
2020-08-28 13:35:52 +03:00
parent f010dc533c
commit 07c353973d
6 changed files with 20 additions and 22 deletions
@@ -711,16 +711,3 @@ private inline fun Any.errorMessage(): String {
private fun errorSupportedOnlyInTypeInference(): Nothing {
error("supported only in type inference context")
}
@OptIn(ExperimentalContracts::class)
fun requireOrDescribe(condition: Boolean, value: Any?) {
contract {
returns() implies condition
}
require(condition) {
val typeInfo = if (value != null) {
", type = '${value::class}'"
} else ""
"Unexpected: value = '$value'$typeInfo"
}
}