Skip to content

Commit b370497

Browse files
committed
Avoid split overrides
1 parent 8266a22 commit b370497

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,6 +1957,18 @@ open class KotlinFileExtractor(
19571957
}
19581958
}
19591959

1960+
private fun getCalleeRealOverrideTarget(f: IrFunction): IrFunction {
1961+
val target = f.target.realOverrideTarget
1962+
return if (overridesCollectionsMethodWithAlteredParameterTypes(f))
1963+
// Cope with the case where an inherited callee can be rewritten with substituted parameter types
1964+
// if the child class uses it to implement a collections interface
1965+
// (for example, `class A { boolean contains(Object o) { ... } }; class B<T> extends A implements Set<T> { ... }`
1966+
// leads to generating a function `A.contains(B::T)`, with `initialSignatureFunction` pointing to `A.contains(Object)`.
1967+
(target as? IrLazyFunction)?.initialSignatureFunction ?: target
1968+
else
1969+
target
1970+
}
1971+
19601972
fun extractRawMethodAccess(
19611973
syntacticCallTarget: IrFunction,
19621974
locElement: IrElement,
@@ -2012,18 +2024,6 @@ open class KotlinFileExtractor(
20122024
}
20132025
}
20142026

2015-
private fun getCalleeRealOverrideTarget(f: IrFunction): IrFunction {
2016-
val target = f.target.realOverrideTarget
2017-
return if (overridesCollectionsMethodWithAlteredParameterTypes(f))
2018-
// Cope with the case where an inherited callee can be rewritten with substituted parameter types
2019-
// if the child class uses it to implement a collections interface
2020-
// (for example, `class A { boolean contains(Object o) { ... } }; class B<T> extends A implements Set<T> { ... }`
2021-
// leads to generating a function `A.contains(B::T)`, with `initialSignatureFunction` pointing to `A.contains(Object)`.
2022-
(target as? IrLazyFunction)?.initialSignatureFunction ?: target
2023-
else
2024-
target
2025-
}
2026-
20272027
fun extractRawMethodAccess(
20282028
syntacticCallTarget: IrFunction,
20292029
locId: Label<DbLocation>,

0 commit comments

Comments
 (0)