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");
|
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
|
@Test
|
||||||
@TestMetadata("resultInlining.kt")
|
@TestMetadata("resultInlining.kt")
|
||||||
public void testResultInlining() throws Exception {
|
public void testResultInlining() throws Exception {
|
||||||
|
|||||||
+2
@@ -637,6 +637,8 @@ class ExpressionCodegen(
|
|||||||
private fun unboxResultIfNeeded(arg: IrGetValue) {
|
private fun unboxResultIfNeeded(arg: IrGetValue) {
|
||||||
if (arg.type.erasedUpperBound.fqNameWhenAvailable != StandardNames.RESULT_FQ_NAME) return
|
if (arg.type.erasedUpperBound.fqNameWhenAvailable != StandardNames.RESULT_FQ_NAME) return
|
||||||
if (irFunction !is IrSimpleFunction) 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 index = (arg.symbol as? IrValueParameterSymbol)?.owner?.index ?: return
|
||||||
val genericOrAnyOverride = irFunction.overriddenSymbols.any {
|
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");
|
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
|
@Test
|
||||||
@TestMetadata("resultInlining.kt")
|
@TestMetadata("resultInlining.kt")
|
||||||
public void testResultInlining() throws Exception {
|
public void testResultInlining() throws Exception {
|
||||||
|
|||||||
+6
@@ -16328,6 +16328,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/removeInInlineCollectionOfInlineClassAsInt.kt");
|
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
|
@Test
|
||||||
@TestMetadata("resultInlining.kt")
|
@TestMetadata("resultInlining.kt")
|
||||||
public void testResultInlining() throws Exception {
|
public void testResultInlining() throws Exception {
|
||||||
|
|||||||
+5
@@ -14307,6 +14307,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/removeInInlineCollectionOfInlineClassAsInt.kt");
|
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")
|
@TestMetadata("resultInlining.kt")
|
||||||
public void testResultInlining() throws Exception {
|
public void testResultInlining() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/resultInlining.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/resultInlining.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -12247,6 +12247,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/removeInInlineCollectionOfInlineClassAsInt.kt");
|
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")
|
@TestMetadata("resultInlining.kt")
|
||||||
public void testResultInlining() throws Exception {
|
public void testResultInlining() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/resultInlining.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/resultInlining.kt");
|
||||||
|
|||||||
Generated
+5
@@ -12247,6 +12247,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/removeInInlineCollectionOfInlineClassAsInt.kt");
|
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")
|
@TestMetadata("resultInlining.kt")
|
||||||
public void testResultInlining() throws Exception {
|
public void testResultInlining() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/resultInlining.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/resultInlining.kt");
|
||||||
|
|||||||
Generated
+5
@@ -12312,6 +12312,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/removeInInlineCollectionOfInlineClassAsInt.kt");
|
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")
|
@TestMetadata("resultInlining.kt")
|
||||||
public void testResultInlining() throws Exception {
|
public void testResultInlining() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/resultInlining.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/resultInlining.kt");
|
||||||
|
|||||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -6703,6 +6703,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/referToUnderlyingPropertyOfInlineClass.kt");
|
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")
|
@TestMetadata("resultInlining.kt")
|
||||||
public void testResultInlining() throws Exception {
|
public void testResultInlining() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/resultInlining.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/resultInlining.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user