JVM_IR: Do not unbox Result parameter in Result methods
#KT-44140 Fixed
This commit is contained in:
+6
@@ -16328,6 +16328,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/removeInInlineCollectionOfInlineClassAsInt.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("result.kt")
|
||||
public void testResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/result.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resultInlining.kt")
|
||||
public void testResultInlining() throws Exception {
|
||||
|
||||
+2
@@ -637,6 +637,8 @@ class ExpressionCodegen(
|
||||
private fun unboxResultIfNeeded(arg: IrGetValue) {
|
||||
if (arg.type.erasedUpperBound.fqNameWhenAvailable != StandardNames.RESULT_FQ_NAME) return
|
||||
if (irFunction !is IrSimpleFunction) return
|
||||
// Skip Result's methods
|
||||
if (irFunction.parentAsClass.fqNameWhenAvailable == StandardNames.RESULT_FQ_NAME) return
|
||||
|
||||
val index = (arg.symbol as? IrValueParameterSymbol)?.owner?.index ?: return
|
||||
val genericOrAnyOverride = irFunction.overriddenSymbols.any {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// IGNORE_BACKEND: WASM, JS_IR
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// FILE: result.kt
|
||||
|
||||
package kotlin
|
||||
|
||||
inline class Result(val value: Any?)
|
||||
|
||||
// FILE: box.kt
|
||||
|
||||
fun box(): String {
|
||||
return Result("OK").value as String
|
||||
}
|
||||
+6
@@ -16328,6 +16328,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/removeInInlineCollectionOfInlineClassAsInt.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("result.kt")
|
||||
public void testResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/result.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resultInlining.kt")
|
||||
public void testResultInlining() throws Exception {
|
||||
|
||||
+6
@@ -16328,6 +16328,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/removeInInlineCollectionOfInlineClassAsInt.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("result.kt")
|
||||
public void testResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/result.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resultInlining.kt")
|
||||
public void testResultInlining() throws Exception {
|
||||
|
||||
+5
@@ -14307,6 +14307,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/removeInInlineCollectionOfInlineClassAsInt.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("result.kt")
|
||||
public void testResult() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/result.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("resultInlining.kt")
|
||||
public void testResultInlining() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/resultInlining.kt");
|
||||
|
||||
Reference in New Issue
Block a user