提交 cce9469e 编写于 作者: I Ilmir Usmanov

JVM_IR: Do not unbox Result parameter in Result methods

 #KT-44140 Fixed
上级 10d9259d
......@@ -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 {
......@@ -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 {
......
// 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
}
......@@ -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 {
......@@ -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 {
......@@ -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");
......@@ -12247,6 +12247,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
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");
......@@ -12247,6 +12247,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
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");
......@@ -12312,6 +12312,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
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");
......@@ -6703,6 +6703,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/inlineClasses/referToUnderlyingPropertyOfInlineClass.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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册