Files
Dmitrii Gridin 33e6a85a2d [LL FIR] rename testdata to testData to avoid copyright generation
We exclude testData pattern from copyright scope
2023-09-18 21:12:45 +00:00

19 lines
479 B
Kotlin
Vendored

fun ex<caret>pression(expression: IrConst<*>) {
when (val kind = expression.kind) {
is Kind.Null -> kind.valueOf(expression)
else -> {}
}
}
sealed class Kind<T>(val asString: String) {
@Suppress("UNCHECKED_CAST")
fun valueOf(aConst: IrConst<*>) = (aConst as IrConst<T>).value
object Null : Kind<Nothing?>("Null")
override fun toString() = asString
}
abstract class IrConst<T> {
abstract var kind: Kind<T>
abstract var value: T
}