JVM_IR KT-49136 don't optimize null checks on fields and calls
This commit is contained in:
+3
@@ -64,4 +64,7 @@ interface CommonBackendContext : BackendContext, LoggingContext {
|
||||
|
||||
val optimizeLoopsOverUnsignedArrays: Boolean
|
||||
get() = false
|
||||
|
||||
val optimizeNullChecksUsingKotlinNullability: Boolean
|
||||
get() = true
|
||||
}
|
||||
|
||||
+2
-2
@@ -146,9 +146,9 @@ class IfNullExpressionsFusionLowering(val context: CommonBackendContext) : FileL
|
||||
is IrGetClass ->
|
||||
false
|
||||
is IrCall ->
|
||||
if (!type.isNullable()) false else null
|
||||
if (context.optimizeNullChecksUsingKotlinNullability && !type.isNullable()) false else null
|
||||
is IrGetField ->
|
||||
if (!type.isNullable()) false else null
|
||||
if (context.optimizeNullChecksUsingKotlinNullability && !type.isNullable()) false else null
|
||||
is IrBlock -> {
|
||||
val singleExpr = statements.singleOrNull()
|
||||
if (singleExpr is IrExpression && singleExpr.type == type)
|
||||
|
||||
Reference in New Issue
Block a user