[analysis api fir] put every library into a separate KtModule in tests
This commit is contained in:
+25
@@ -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" }
|
||||
}
|
||||
Reference in New Issue
Block a user