From b370497f96bd93851313608a651aaa2cf1a27d6b Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Sat, 29 Oct 2022 18:23:45 +0100 Subject: [PATCH] Avoid split overrides --- .../src/main/kotlin/KotlinFileExtractor.kt | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt index fac22bad15d..c20a5d6e5ad 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt @@ -1957,6 +1957,18 @@ open class KotlinFileExtractor( } } + private fun getCalleeRealOverrideTarget(f: IrFunction): IrFunction { + val target = f.target.realOverrideTarget + return if (overridesCollectionsMethodWithAlteredParameterTypes(f)) + // Cope with the case where an inherited callee can be rewritten with substituted parameter types + // if the child class uses it to implement a collections interface + // (for example, `class A { boolean contains(Object o) { ... } }; class B extends A implements Set { ... }` + // leads to generating a function `A.contains(B::T)`, with `initialSignatureFunction` pointing to `A.contains(Object)`. + (target as? IrLazyFunction)?.initialSignatureFunction ?: target + else + target + } + fun extractRawMethodAccess( syntacticCallTarget: IrFunction, locElement: IrElement, @@ -2012,18 +2024,6 @@ open class KotlinFileExtractor( } } - private fun getCalleeRealOverrideTarget(f: IrFunction): IrFunction { - val target = f.target.realOverrideTarget - return if (overridesCollectionsMethodWithAlteredParameterTypes(f)) - // Cope with the case where an inherited callee can be rewritten with substituted parameter types - // if the child class uses it to implement a collections interface - // (for example, `class A { boolean contains(Object o) { ... } }; class B extends A implements Set { ... }` - // leads to generating a function `A.contains(B::T)`, with `initialSignatureFunction` pointing to `A.contains(Object)`. - (target as? IrLazyFunction)?.initialSignatureFunction ?: target - else - target - } - fun extractRawMethodAccess( syntacticCallTarget: IrFunction, locId: Label,