[FIR2IR] Don't create implicit not null cast on IrGetEnumValue
This commit is contained in:
+2
-3
@@ -230,11 +230,10 @@ class Fir2IrImplicitCastInserter(
|
|||||||
canBeNull || hasEnhancedNullability()
|
canBeNull || hasEnhancedNullability()
|
||||||
|
|
||||||
private fun IrExpression.insertImplicitNotNullCastIfNeeded(expression: FirExpression): IrExpression {
|
private fun IrExpression.insertImplicitNotNullCastIfNeeded(expression: FirExpression): IrExpression {
|
||||||
|
if (this is IrGetEnumValue) return this
|
||||||
// [TypeOperatorLowering] will retrieve the source (from start offset to end offset) as an assertion message.
|
// [TypeOperatorLowering] will retrieve the source (from start offset to end offset) as an assertion message.
|
||||||
// Avoid type casting if we can't determine the source for some reasons, e.g., implicit `this` receiver.
|
// Avoid type casting if we can't determine the source for some reasons, e.g., implicit `this` receiver.
|
||||||
if (expression.source == null) {
|
if (expression.source == null) return this
|
||||||
return this
|
|
||||||
}
|
|
||||||
// Cast type massage 1. Remove @EnhancedNullability
|
// Cast type massage 1. Remove @EnhancedNullability
|
||||||
// Cast type massage 2. Convert it to a non-null variant (in case of @FlexibleNullability)
|
// Cast type massage 2. Convert it to a non-null variant (in case of @FlexibleNullability)
|
||||||
val castType = type.removeAnnotations {
|
val castType = type.removeAnnotations {
|
||||||
|
|||||||
Reference in New Issue
Block a user