Remove redundant upcast in JvmPropertiesLowering

#KT-48621 Fixed
This commit is contained in:
Mikhail Glukhikh
2021-09-06 15:17:59 +03:00
committed by TeamCityServer
parent 6f954462d6
commit 20ddaa9ebf
6 changed files with 3 additions and 16 deletions
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.ir.expressions.IrFieldAccessExpression
import org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.classifierOrNull
import org.jetbrains.kotlin.ir.types.isSubtypeOfClass
import org.jetbrains.kotlin.ir.types.makeNotNull
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
@@ -118,7 +119,8 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE
val receiver = expression.dispatchReceiver
if (receiver != null) {
val propertyParent = irProperty.parent
if (propertyParent is IrClass && propertyParent.symbol != receiver.type.classifierOrNull &&
if (propertyParent is IrClass &&
receiver.type.classifierOrNull?.isSubtypeOfClass(propertyParent.symbol) != true &&
expression.superQualifierSymbol == null
) {
return irImplicitCast(receiver, propertyParent.defaultType)
-3
View File
@@ -1,8 +1,5 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
// - FIR2IR should generate call to fake override
// WITH_RUNTIME
// FILE: 1.kt
-3
View File
@@ -1,8 +1,5 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
// - FIR2IR should generate call to fake override
// WITH_RUNTIME
// FILE: 1.kt
@@ -1,9 +1,6 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// IGNORE_BACKEND_FIR: JVM_IR
// - FIR2IR should generate call to fake override
// FILE: A.kt
package a
import b.*
@@ -1,9 +1,6 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// IGNORE_BACKEND_FIR: JVM_IR
// - FIR2IR should generate call to fake override
// FILE: a.kt
package a
@@ -1,9 +1,6 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// IGNORE_BACKEND_FIR: JVM_IR
// - FIR2IR should generate call to fake override
// FILE: a.kt
package a