JVM IR: Take superQualifierSymbols into account when lowering inline classes
This commit is contained in:
committed by
Alexander Udalov
parent
52abc2ae1a
commit
821aca984b
Generated
+5
@@ -12873,6 +12873,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mangledSuperCalls.kt")
|
||||
public void testMangledSuperCalls() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledSuperCalls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mapInlineClassesWithSuppressWildcardsMode.kt")
|
||||
public void testMapInlineClassesWithSuppressWildcardsMode() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mapInlineClassesWithSuppressWildcardsMode.kt");
|
||||
|
||||
+1
-1
@@ -255,7 +255,7 @@ private class JvmInlineClassLowering(private val context: JvmBackendContext) : F
|
||||
val replacement = context.inlineClassReplacements.getReplacementFunction(function)
|
||||
?: return super.visitFunctionAccess(expression)
|
||||
return context.createIrBuilder(currentScope!!.scope.scopeOwnerSymbol, expression.startOffset, expression.endOffset)
|
||||
.irCall(replacement).apply {
|
||||
.irCall(replacement, expression.origin, expression.safeAs<IrCall>()?.superQualifierSymbol).apply {
|
||||
buildReplacement(function, expression, replacement)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ fun IrBuilderWithScope.irCall(callee: IrFunctionSymbol, descriptor: FunctionDesc
|
||||
fun IrBuilderWithScope.irCall(callee: IrFunction): IrFunctionAccessExpression =
|
||||
irCall(callee.symbol)
|
||||
|
||||
fun IrBuilderWithScope.irCall(callee: IrFunction, origin: IrStatementOrigin, superQualifierSymbol: IrClassSymbol? = null): IrCall =
|
||||
fun IrBuilderWithScope.irCall(callee: IrFunction, origin: IrStatementOrigin? = null, superQualifierSymbol: IrClassSymbol? = null): IrCall =
|
||||
IrCallImpl(
|
||||
startOffset, endOffset, callee.returnType,
|
||||
callee.symbol as IrSimpleFunctionSymbol,
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
inline class I(val i: Int)
|
||||
|
||||
abstract class A {
|
||||
abstract fun f(i: I): String
|
||||
}
|
||||
|
||||
open class B : A() {
|
||||
override fun f(i: I): String = "OK"
|
||||
}
|
||||
|
||||
class C : B() {
|
||||
override fun f(i: I): String = super.f(i)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return C().f(I(0))
|
||||
}
|
||||
+5
@@ -14088,6 +14088,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mangledSuperCalls.kt")
|
||||
public void testMangledSuperCalls() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledSuperCalls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mapInlineClassesWithSuppressWildcardsMode.kt")
|
||||
public void testMapInlineClassesWithSuppressWildcardsMode() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mapInlineClassesWithSuppressWildcardsMode.kt");
|
||||
|
||||
+5
@@ -14093,6 +14093,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mangledSuperCalls.kt")
|
||||
public void testMangledSuperCalls() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledSuperCalls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mapInlineClassesWithSuppressWildcardsMode.kt")
|
||||
public void testMapInlineClassesWithSuppressWildcardsMode() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mapInlineClassesWithSuppressWildcardsMode.kt");
|
||||
|
||||
+5
@@ -12873,6 +12873,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mangledSuperCalls.kt")
|
||||
public void testMangledSuperCalls() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledSuperCalls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mapInlineClassesWithSuppressWildcardsMode.kt")
|
||||
public void testMapInlineClassesWithSuppressWildcardsMode() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mapInlineClassesWithSuppressWildcardsMode.kt");
|
||||
|
||||
Generated
+5
@@ -11078,6 +11078,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mangledSuperCalls.kt")
|
||||
public void testMangledSuperCalls() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledSuperCalls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt")
|
||||
public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt");
|
||||
|
||||
+5
@@ -11143,6 +11143,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledDefaultParameterFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mangledSuperCalls.kt")
|
||||
public void testMangledSuperCalls() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/mangledSuperCalls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noAssertionsOnInlineClassBasedOnNullableType.kt")
|
||||
public void testNoAssertionsOnInlineClassBasedOnNullableType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/noAssertionsOnInlineClassBasedOnNullableType.kt");
|
||||
|
||||
Reference in New Issue
Block a user