KT-57103 Don't inline references to generic synthetic Java properties in K1
This commit is contained in:
committed by
Space Team
parent
5ddd60a015
commit
9db5ea66a6
+6
@@ -50193,6 +50193,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
|||||||
runTest("compiler/testData/codegen/box/syntheticExtensions/kt56154.kt");
|
runTest("compiler/testData/codegen/box/syntheticExtensions/kt56154.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt57103.kt")
|
||||||
|
public void testKt57103() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/syntheticExtensions/kt57103.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("overrideKotlinPropertyByJavaMethod.kt")
|
@TestMetadata("overrideKotlinPropertyByJavaMethod.kt")
|
||||||
public void testOverrideKotlinPropertyByJavaMethod() throws Exception {
|
public void testOverrideKotlinPropertyByJavaMethod() throws Exception {
|
||||||
|
|||||||
+6
@@ -50193,6 +50193,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
|||||||
runTest("compiler/testData/codegen/box/syntheticExtensions/kt56154.kt");
|
runTest("compiler/testData/codegen/box/syntheticExtensions/kt56154.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt57103.kt")
|
||||||
|
public void testKt57103() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/syntheticExtensions/kt57103.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("overrideKotlinPropertyByJavaMethod.kt")
|
@TestMetadata("overrideKotlinPropertyByJavaMethod.kt")
|
||||||
public void testOverrideKotlinPropertyByJavaMethod() throws Exception {
|
public void testOverrideKotlinPropertyByJavaMethod() throws Exception {
|
||||||
|
|||||||
+10
-2
@@ -78,8 +78,16 @@ private class InlineCallableReferenceToLambdaVisitor(val context: JvmBackendCont
|
|||||||
this is IrFunctionReference -> // ::function -> { args... -> function(args...) }
|
this is IrFunctionReference -> // ::function -> { args... -> function(args...) }
|
||||||
wrapFunction(symbol.owner).toLambda(this, scope!!)
|
wrapFunction(symbol.owner).toLambda(this, scope!!)
|
||||||
|
|
||||||
this is IrPropertyReference -> // ::property -> { receiver -> receiver.property }; prefer direct field access if allowed.
|
this is IrPropertyReference ->
|
||||||
(if (field != null) wrapField(field!!.owner) else wrapFunction(getter!!.owner)).toLambda(this, scope!!)
|
// References to generic synthetic Java properties aren't inlined in K1. Fixes KT-57103
|
||||||
|
if (typeArgumentsCount > 0 &&
|
||||||
|
symbol.owner.origin.let {
|
||||||
|
it == IrDeclarationOrigin.SYNTHETIC_JAVA_PROPERTY_DELEGATE || it == IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB
|
||||||
|
}
|
||||||
|
) this
|
||||||
|
// ::property -> { receiver -> receiver.property }; prefer direct field access if allowed.
|
||||||
|
else (if (field != null) wrapField(field!!.owner) else wrapFunction(getter!!.owner)).toLambda(this, scope!!)
|
||||||
|
|
||||||
|
|
||||||
else -> this // not an inline argument
|
else -> this // not an inline argument
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -1,6 +1,4 @@
|
|||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// IGNORE_BACKEND_K1: JVM_IR
|
|
||||||
// K1_STATUS: Broken because of KT-57103
|
|
||||||
|
|
||||||
// FILE: J.java
|
// FILE: J.java
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// !LANGUAGE: +ReferencesToSyntheticJavaProperties
|
||||||
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
|
||||||
|
// FILE: J.java
|
||||||
|
|
||||||
|
public class J<T> {
|
||||||
|
private final T value;
|
||||||
|
public J(T value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
public T getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T foo() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val j = J("OK")
|
||||||
|
return run(j::value)
|
||||||
|
}
|
||||||
+6
@@ -50193,6 +50193,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/syntheticExtensions/kt56154.kt");
|
runTest("compiler/testData/codegen/box/syntheticExtensions/kt56154.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("kt57103.kt")
|
||||||
|
public void testKt57103() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/syntheticExtensions/kt57103.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("overrideKotlinPropertyByJavaMethod.kt")
|
@TestMetadata("overrideKotlinPropertyByJavaMethod.kt")
|
||||||
public void testOverrideKotlinPropertyByJavaMethod() throws Exception {
|
public void testOverrideKotlinPropertyByJavaMethod() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user