diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallGenerator.kt index 0f6b851857d..439f62598ce 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/CallGenerator.kt @@ -24,6 +24,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.ir.declarations.IrFunction +import org.jetbrains.kotlin.ir.declarations.IrProperty import org.jetbrains.kotlin.ir.expressions.IrErrorCallExpression import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin @@ -55,7 +56,11 @@ internal class CallGenerator( symbol.owner.backingField?.symbol, symbol.owner.getter?.symbol, symbol.owner.setter?.symbol - ) + ).apply { + if (callableReferenceAccess.explicitReceiver !is FirResolvedQualifier) { + applyReceivers(callableReferenceAccess) + } + } } is IrFunctionSymbol -> { IrFunctionReferenceImpl( @@ -359,6 +364,16 @@ internal class CallGenerator( } this } + is IrNoArgumentsCallableReferenceBase -> { + val ownerPropertyGetter = (symbol.owner as? IrProperty)?.getter + if (ownerPropertyGetter?.dispatchReceiverParameter != null) { + dispatchReceiver = qualifiedAccess.findIrDispatchReceiver() + } + if (ownerPropertyGetter?.extensionReceiverParameter != null) { + extensionReceiver = qualifiedAccess.findIrExtensionReceiver() + } + this + } is IrFieldExpressionBase -> { val ownerField = symbol.owner if (!ownerField.isStatic) { diff --git a/compiler/testData/codegen/box/callableReference/bound/array.kt b/compiler/testData/codegen/box/callableReference/bound/array.kt index af5b86c9d73..2a78bb9cc88 100644 --- a/compiler/testData/codegen/box/callableReference/bound/array.kt +++ b/compiler/testData/codegen/box/callableReference/bound/array.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR open class A { var f: String = "OK" } diff --git a/compiler/testData/codegen/box/callableReference/bound/equals/nullableReceiverInEquals.kt b/compiler/testData/codegen/box/callableReference/bound/equals/nullableReceiverInEquals.kt index 88f4cc64927..7d6676553bb 100644 --- a/compiler/testData/codegen/box/callableReference/bound/equals/nullableReceiverInEquals.kt +++ b/compiler/testData/codegen/box/callableReference/bound/equals/nullableReceiverInEquals.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JS_IR // TODO: investigate should it be ran for JS or not // IGNORE_BACKEND: JS diff --git a/compiler/testData/codegen/box/callableReference/bound/genericValOnLHS.kt b/compiler/testData/codegen/box/callableReference/bound/genericValOnLHS.kt index ab5ec9a45e8..8911473c689 100644 --- a/compiler/testData/codegen/box/callableReference/bound/genericValOnLHS.kt +++ b/compiler/testData/codegen/box/callableReference/bound/genericValOnLHS.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR - class Generic
(val p: P)
class Host {
diff --git a/compiler/testData/codegen/box/callableReference/bound/nullReceiver.kt b/compiler/testData/codegen/box/callableReference/bound/nullReceiver.kt
index 90ce5a256a6..0111a54d58b 100644
--- a/compiler/testData/codegen/box/callableReference/bound/nullReceiver.kt
+++ b/compiler/testData/codegen/box/callableReference/bound/nullReceiver.kt
@@ -1,4 +1,3 @@
-// IGNORE_BACKEND_FIR: JVM_IR
val String?.ok: String
get() = "OK"
diff --git a/compiler/testData/codegen/box/callableReference/bound/simpleProperty.kt b/compiler/testData/codegen/box/callableReference/bound/simpleProperty.kt
index b853f97cbdf..c271b1c6418 100644
--- a/compiler/testData/codegen/box/callableReference/bound/simpleProperty.kt
+++ b/compiler/testData/codegen/box/callableReference/bound/simpleProperty.kt
@@ -1,4 +1,3 @@
-// IGNORE_BACKEND_FIR: JVM_IR
fun box(): String {
val f = "kotlin"::length
val result = f.get()
diff --git a/compiler/testData/codegen/box/callableReference/property/kt15447.kt b/compiler/testData/codegen/box/callableReference/property/kt15447.kt
index 76341129f0a..d1d9a817df9 100644
--- a/compiler/testData/codegen/box/callableReference/property/kt15447.kt
+++ b/compiler/testData/codegen/box/callableReference/property/kt15447.kt
@@ -1,4 +1,3 @@
-// IGNORE_BACKEND_FIR: JVM_IR
//WITH_RUNTIME
fun box(): String {
diff --git a/compiler/testData/codegen/box/callableReference/property/receiverEvaluatedOnce.kt b/compiler/testData/codegen/box/callableReference/property/receiverEvaluatedOnce.kt
index e2efca35253..3b58ed7b9a5 100644
--- a/compiler/testData/codegen/box/callableReference/property/receiverEvaluatedOnce.kt
+++ b/compiler/testData/codegen/box/callableReference/property/receiverEvaluatedOnce.kt
@@ -1,4 +1,3 @@
-// IGNORE_BACKEND_FIR: JVM_IR
// WITH_REFLECT
import kotlin.reflect.KProperty0
diff --git a/compiler/testData/codegen/box/callableReference/serializability/boundWithNotSerializableReceiver.kt b/compiler/testData/codegen/box/callableReference/serializability/boundWithNotSerializableReceiver.kt
index 15e3a1d2735..6610a175a4e 100644
--- a/compiler/testData/codegen/box/callableReference/serializability/boundWithNotSerializableReceiver.kt
+++ b/compiler/testData/codegen/box/callableReference/serializability/boundWithNotSerializableReceiver.kt
@@ -1,4 +1,3 @@
-// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
// FULL_JDK
diff --git a/compiler/testData/codegen/box/callableReference/serializability/boundWithSerializableReceiver.kt b/compiler/testData/codegen/box/callableReference/serializability/boundWithSerializableReceiver.kt
index 11d4905cbe1..88cf4382f61 100644
--- a/compiler/testData/codegen/box/callableReference/serializability/boundWithSerializableReceiver.kt
+++ b/compiler/testData/codegen/box/callableReference/serializability/boundWithSerializableReceiver.kt
@@ -1,3 +1,4 @@
+// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// WITH_REFLECT
diff --git a/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassMemberVal.kt b/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassMemberVal.kt
index e3e8237af6e..29a89e3ede5 100644
--- a/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassMemberVal.kt
+++ b/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassMemberVal.kt
@@ -1,5 +1,4 @@
// !LANGUAGE: +InlineClasses
-// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
inline class Z(val x: Int) {
diff --git a/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassPrimaryVal.kt b/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassPrimaryVal.kt
index 9fdd675d5f5..1c1dd71e21e 100644
--- a/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassPrimaryVal.kt
+++ b/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassPrimaryVal.kt
@@ -1,5 +1,4 @@
// !LANGUAGE: +InlineClasses
-// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
inline class Z(val x: Int)
diff --git a/compiler/testData/codegen/box/inlineClasses/callableReferences/inlineClassTypeBoundMemberVar.kt b/compiler/testData/codegen/box/inlineClasses/callableReferences/inlineClassTypeBoundMemberVar.kt
index 278a5d21cb8..a515a3da6c2 100644
--- a/compiler/testData/codegen/box/inlineClasses/callableReferences/inlineClassTypeBoundMemberVar.kt
+++ b/compiler/testData/codegen/box/inlineClasses/callableReferences/inlineClassTypeBoundMemberVar.kt
@@ -1,5 +1,4 @@
// !LANGUAGE: +InlineClasses
-// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
inline class Z(val x: Int)
diff --git a/compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/innerSubclass.kt b/compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/innerSubclass.kt
index 8dc7a5d8c5c..63c15894b45 100644
--- a/compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/innerSubclass.kt
+++ b/compiler/testData/codegen/box/properties/lateinit/isInitializedAndDeinitialize/innerSubclass.kt
@@ -1,4 +1,3 @@
-// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
open class Foo {
diff --git a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.fir.txt b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.fir.txt
index d6a56b70722..26d05e16a3c 100644
--- a/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.fir.txt
+++ b/compiler/testData/ir/irText/declarations/provideDelegate/memberExtension.fir.txt
@@ -63,6 +63,8 @@ FILE fqName: