JVM IR: reorder some resolveFakeOverride calls
This commit is contained in:
committed by
Space Team
parent
29fab6c3eb
commit
35d498847e
+10
-11
@@ -268,11 +268,10 @@ private class InterfaceObjectCallsLowering(val context: JvmBackendContext) : IrE
|
||||
if (expression.superQualifierSymbol != null && !expression.isSuperToAny()) return
|
||||
|
||||
val callee = expression.symbol.owner
|
||||
if (!callee.isMethodOfAny()) return
|
||||
if (!callee.hasInterfaceParent() && expression.dispatchReceiver?.run { type.erasedUpperBound.isJvmInterface } != true) return
|
||||
|
||||
val resolved = callee.resolveFakeOverride()
|
||||
if (resolved?.isMethodOfAny() != true) return
|
||||
|
||||
val resolved = callee.resolveFakeOverride() ?: return
|
||||
expression.symbol = resolved.symbol
|
||||
if (expression.superQualifierSymbol != null) {
|
||||
expression.superQualifierSymbol = context.irBuiltIns.anyClass
|
||||
@@ -293,6 +292,14 @@ internal fun IrSimpleFunction.findInterfaceImplementation(jvmDefaultMode: JvmDef
|
||||
|
||||
val implementation = resolveFakeOverride(toSkip = ::isDefaultImplsBridge) ?: return null
|
||||
|
||||
if (!implementation.hasInterfaceParent()
|
||||
|| DescriptorVisibilities.isPrivate(implementation.visibility)
|
||||
|| implementation.isDefinitelyNotDefaultImplsMethod(jvmDefaultMode, implementation)
|
||||
|| implementation.isMethodOfAny()
|
||||
) {
|
||||
return null
|
||||
}
|
||||
|
||||
// Only generate interface delegation for functions immediately inherited from an interface.
|
||||
// (Otherwise, delegation will be present in the parent class)
|
||||
if (overriddenSymbols.any {
|
||||
@@ -303,14 +310,6 @@ internal fun IrSimpleFunction.findInterfaceImplementation(jvmDefaultMode: JvmDef
|
||||
return null
|
||||
}
|
||||
|
||||
if (!implementation.hasInterfaceParent()
|
||||
|| DescriptorVisibilities.isPrivate(implementation.visibility)
|
||||
|| implementation.isDefinitelyNotDefaultImplsMethod(jvmDefaultMode)
|
||||
|| implementation.isMethodOfAny()
|
||||
) {
|
||||
return null
|
||||
}
|
||||
|
||||
return implementation
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user