[analysis api fir] put every library into a separate KtModule in tests

This commit is contained in:
Ilya Kirillov
2022-04-07 08:09:00 +02:00
parent 252d8e283b
commit 2649788b87
43 changed files with 778 additions and 399 deletions
@@ -0,0 +1,25 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.utils.errors
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.contract
@OptIn(ExperimentalContracts::class)
public inline fun <reified T> requireIsInstance(obj: Any) {
contract {
returns() implies (obj is T)
}
require(obj is T) { "Expected ${T::class} instead of ${obj::class} for $obj" }
}
@OptIn(ExperimentalContracts::class)
public inline fun <reified T> checkIsInstance(obj: Any) {
contract {
returns() implies (obj is T)
}
check(obj is T) { "Expected ${T::class} instead of ${obj::class} for $obj" }
}