[FIR2IR] Simplify generation of bound callable reference receivers

Remove a bunch of custom logic to determine when a callable reference is
bound or not (and hence mustn't have a receiver). Instead, a helper
extension is introduced to determine when a callable reference is bound
by checking if dispatch/extensionReceiver is not FirNoReceiver and the
referenced member is not static.

#KT-57253 Fixed
This commit is contained in:
Kirill Rakhman
2023-03-10 17:18:51 +01:00
committed by Space Team
parent a3f0e429e3
commit b476eee6e3
3 changed files with 25 additions and 60 deletions
@@ -55,6 +55,17 @@ fun box(): String {
if (!callContext(A::instanceProp, A.Companion)) return "Fail unbound 7"
if (!callContext(A::extProp, A.Companion)) return "Fail unbound 8"
with (A) {
if (!call(::instance)) return "Fail implicit bound function 1"
if (!call(::companion)) return "Fail implicit bound function 2"
if (!call(::ext)) return "Fail implicit bound function 3"
if (!call(::companionExt)) return "Fail implicit bound function 4"
if (!call(::instanceProp)) return "Fail imlicit bound prop 5"
if (!call(::companionProp)) return "Fail imlicit bound prop 6"
if (!call(::extProp)) return "Fail imlicit bound prop 7"
if (!call(::companionExtProp)) return "Fail imlicit bound prop 8"
}
val instance = A::instance
val ext = A::ext
val instanceProp = A::instanceProp