diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt index bb20c1ca327..ac0ebd1ce02 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/types/irTypes.kt @@ -81,10 +81,14 @@ fun IrType.removeAnnotations(): IrType = } val IrType.classifierOrFail: IrClassifierSymbol - get() = cast().classifier + get() = classifierOrNull ?: error("Can't get classifier of ${render()}") val IrType.classifierOrNull: IrClassifierSymbol? - get() = safeAs()?.classifier + get() = when (this) { + is IrSimpleType -> classifier + is IrDefinitelyNotNullType -> original.classifierOrNull + else -> null + } val IrType.classOrNull: IrClassSymbol? get() = diff --git a/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt b/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt index af6f5f856d1..1f78a794d4b 100644 --- a/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt +++ b/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedArrayType.kt @@ -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) diff --git a/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedType.kt b/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedType.kt index 3eb4952fb33..3a7c2fab450 100644 --- a/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedType.kt +++ b/compiler/testData/codegen/box/unsignedTypes/evaluateConstructorOfUnsignedType.kt @@ -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