[FIR2IR] Properly handle callable references to static functions
This commit is contained in:
+1
-1
@@ -292,7 +292,7 @@ internal class AdapterGenerator(
|
|||||||
boundDispatchReceiver != null -> irCall.dispatchReceiver = receiverValue
|
boundDispatchReceiver != null -> irCall.dispatchReceiver = receiverValue
|
||||||
boundExtensionReceiver != null -> irCall.extensionReceiver = receiverValue
|
boundExtensionReceiver != null -> irCall.extensionReceiver = receiverValue
|
||||||
}
|
}
|
||||||
} else if (callableReferenceAccess.explicitReceiver is FirResolvedQualifier) {
|
} else if (callableReferenceAccess.explicitReceiver is FirResolvedQualifier && ((firAdaptee as? FirMemberDeclaration)?.isStatic != true)) {
|
||||||
// Unbound callable reference 'A::foo'
|
// Unbound callable reference 'A::foo'
|
||||||
val adaptedReceiverParameter = adapterFunction.valueParameters[0]
|
val adaptedReceiverParameter = adapterFunction.valueParameters[0]
|
||||||
val adaptedReceiverValue = IrGetValueImpl(
|
val adaptedReceiverValue = IrGetValueImpl(
|
||||||
|
|||||||
+6
@@ -15098,6 +15098,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("callableReferenceToStaticFunction.kt")
|
||||||
|
public void testCallableReferenceToStaticFunction() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fir/callableReferenceToStaticFunction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("ClassBuilder.kt")
|
@TestMetadata("ClassBuilder.kt")
|
||||||
public void testClassBuilder() throws Exception {
|
public void testClassBuilder() throws Exception {
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// TARGET_BACKEND: JVM_IR
|
||||||
|
// FULL_JDK
|
||||||
|
// WITH_STDLIB
|
||||||
|
|
||||||
|
import java.nio.file.Files
|
||||||
|
import java.nio.file.Path
|
||||||
|
|
||||||
|
fun test(path: Path): Path? {
|
||||||
|
return path.takeIf(Files::exists)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box() = "OK"
|
||||||
+6
@@ -15098,6 +15098,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("callableReferenceToStaticFunction.kt")
|
||||||
|
public void testCallableReferenceToStaticFunction() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/fir/callableReferenceToStaticFunction.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("ClassBuilder.kt")
|
@TestMetadata("ClassBuilder.kt")
|
||||||
public void testClassBuilder() throws Exception {
|
public void testClassBuilder() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user