JVM IR: Resolve fake overrides during inline class mangling
This is necessary to determine which mangling scheme to use (KT-51672).
This commit is contained in:
+6
@@ -21357,6 +21357,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/kt51353.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/kt51353.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt51672.kt")
|
||||||
|
public void testKt51672() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/kt51672.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||||
public void testMangledDefaultParameterFunction() throws Exception {
|
public void testMangledDefaultParameterFunction() throws Exception {
|
||||||
|
|||||||
+5
-6
@@ -234,12 +234,11 @@ class MemoizedInlineClassReplacements(
|
|||||||
val replacement = buildReplacementInner(function, replacementOrigin, noFakeOverride, useOldManglingScheme, body)
|
val replacement = buildReplacementInner(function, replacementOrigin, noFakeOverride, useOldManglingScheme, body)
|
||||||
// When using the new mangling scheme we might run into dependencies using the old scheme
|
// When using the new mangling scheme we might run into dependencies using the old scheme
|
||||||
// for which we will fall back to the old mangling scheme as well.
|
// for which we will fall back to the old mangling scheme as well.
|
||||||
if (
|
if (!useOldManglingScheme && replacement.name.asString().contains('-') && function.parentClassId != null) {
|
||||||
!useOldManglingScheme &&
|
val resolved = (function as? IrSimpleFunction)?.resolveFakeOverride(true)
|
||||||
replacement.name.asString().contains("-") &&
|
if (resolved?.parentClassId?.let { classFileContainsMethod(it, replacement, context) } == false) {
|
||||||
function.parentClassId?.let { classFileContainsMethod(it, replacement, context) } == false
|
return buildReplacementInner(function, replacementOrigin, noFakeOverride, true, body)
|
||||||
) {
|
}
|
||||||
return buildReplacementInner(function, replacementOrigin, noFakeOverride, true, body)
|
|
||||||
}
|
}
|
||||||
return replacement
|
return replacement
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// MODULE: lib
|
||||||
|
// WITH_STDLIB
|
||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
// FILE: lib.kt
|
||||||
|
@JvmInline
|
||||||
|
value class S(val value: String)
|
||||||
|
|
||||||
|
interface A {
|
||||||
|
fun f(s: S): S = s
|
||||||
|
}
|
||||||
|
|
||||||
|
interface B : A
|
||||||
|
|
||||||
|
// MODULE: main(lib)
|
||||||
|
// FILE: main.kt
|
||||||
|
interface C : B
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return object : C {}.f(S("OK")).value
|
||||||
|
}
|
||||||
+6
@@ -20907,6 +20907,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/kt51353.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/kt51353.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt51672.kt")
|
||||||
|
public void testKt51672() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/kt51672.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||||
public void testMangledDefaultParameterFunction() throws Exception {
|
public void testMangledDefaultParameterFunction() throws Exception {
|
||||||
|
|||||||
+6
@@ -21357,6 +21357,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/kt51353.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/kt51353.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt51672.kt")
|
||||||
|
public void testKt51672() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/kt51672.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||||
public void testMangledDefaultParameterFunction() throws Exception {
|
public void testMangledDefaultParameterFunction() throws Exception {
|
||||||
|
|||||||
+5
@@ -17451,6 +17451,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/kt51353.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/kt51353.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt51672.kt")
|
||||||
|
public void testKt51672() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/kt51672.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("mangledDefaultParameterFunction.kt")
|
@TestMetadata("mangledDefaultParameterFunction.kt")
|
||||||
public void testMangledDefaultParameterFunction() throws Exception {
|
public void testMangledDefaultParameterFunction() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
||||||
|
|||||||
Reference in New Issue
Block a user