053f3b6ac0
To cleanup warnings about useless cast or type check that is always true.
14 lines
384 B
Kotlin
14 lines
384 B
Kotlin
package test
|
|
|
|
import kotlin.internal.NoInfer
|
|
import kotlin.test.fail
|
|
|
|
// just a static type check
|
|
fun <T> assertStaticTypeIs(@Suppress("UNUSED_PARAMETER") value: @NoInfer T) {}
|
|
|
|
inline fun <reified T> assertStaticAndRuntimeTypeIs(value: @NoInfer T) {
|
|
@Suppress("USELESS_CAST")
|
|
if ((value as Any?) !is T) {
|
|
fail("Expected value $value to have ${T::class} type")
|
|
}
|
|
} |