[IR] Fixed IrType.classifierOrNull
Supported IrDefinitelyNotNullType explicitly for now (later it will be better to handle it at the call sites) Co-authored-by: Svyatoslav Scherbina <svyatoslav.scherbina@jetbrains.com>
This commit is contained in:
committed by
Svyatoslav Scherbina
parent
287d988301
commit
d51eb32c62
@@ -81,10 +81,14 @@ fun IrType.removeAnnotations(): IrType =
|
||||
}
|
||||
|
||||
val IrType.classifierOrFail: IrClassifierSymbol
|
||||
get() = cast<IrSimpleType>().classifier
|
||||
get() = classifierOrNull ?: error("Can't get classifier of ${render()}")
|
||||
|
||||
val IrType.classifierOrNull: IrClassifierSymbol?
|
||||
get() = safeAs<IrSimpleType>()?.classifier
|
||||
get() = when (this) {
|
||||
is IrSimpleType -> classifier
|
||||
is IrDefinitelyNotNullType -> original.classifierOrNull
|
||||
else -> null
|
||||
}
|
||||
|
||||
val IrType.classOrNull: IrClassSymbol?
|
||||
get() =
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// WITH_REFLECT
|
||||
// TARGET_BACKEND: JVM
|
||||
// KT-51458:
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
annotation class AnnoUB(val ub: UByteArray)
|
||||
annotation class AnnoUS(val us: UShortArray)
|
||||
|
||||
+2
@@ -1,6 +1,8 @@
|
||||
// !LANGUAGE: -ApproximateIntegerLiteralTypesInReceiverPosition
|
||||
// WITH_REFLECT
|
||||
// TARGET_BACKEND: JVM
|
||||
// KT-51458:
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
// TODO: it's not clear why compilation fails for Android
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
Reference in New Issue
Block a user