FIR2IR: fix receiver of value classes method references

This commit fixes the receiver of these method in FIR2IR code
by removing a particular hack.
However, as the consequence of it 2 black box tests become broken in K2.
The reason is KT-54952 which is not yet fixed

Related to KT-54887
This commit is contained in:
Mikhail Glukhikh
2023-05-11 11:30:25 +02:00
committed by Space Team
parent 95ec7ede66
commit c898b264ba
5 changed files with 5 additions and 6 deletions
@@ -243,10 +243,7 @@ private fun FirCallableSymbol<*>.toSymbolForCall(
}
// Unbound callable reference to member (non-extension)
isReference && fir.receiverParameter == null -> {
// TODO: remove runIf with StandardClassIds.Any comparison after fixing ValueClass::equals case (KT-54887)
runIf(containingClassLookupTag()?.classId != StandardClassIds.Any) {
(explicitReceiver as? FirResolvedQualifier)?.toLookupTag(session)
}
(explicitReceiver as? FirResolvedQualifier)?.toLookupTag(session)
}
else -> null
}
@@ -1,6 +1,7 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS, JS_IR, JS_IR_ES6, NATIVE
// IGNORE_BACKEND_K2: JVM_IR
// WITH_REFLECT
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
@@ -1,6 +1,7 @@
// IGNORE_BACKEND: WASM
// WASM_MUTE_REASON: IGNORED_IN_JS
// IGNORE_BACKEND: JS, JS_IR, JS_IR_ES6, NATIVE
// IGNORE_BACKEND_K2: JVM_IR
// WITH_REFLECT
// WITH_STDLIB
// WORKS_WHEN_VALUE_CLASS
@@ -69,7 +69,7 @@ FILE fqName:<root> fileName:/valueClassEquals.kt
PROPERTY name:equals visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:equals type:kotlin.reflect.KFunction2<<root>.Z, kotlin.Any?, kotlin.Boolean> visibility:private [final,static]
EXPRESSION_BODY
FUNCTION_REFERENCE 'public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any' type=kotlin.reflect.KFunction2<<root>.Z, kotlin.Any?, kotlin.Boolean> origin=null reflectionTarget=<same>
FUNCTION_REFERENCE 'public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Z' type=kotlin.reflect.KFunction2<<root>.Z, kotlin.Any?, kotlin.Boolean> origin=null reflectionTarget=<same>
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-equals> visibility:public modality:FINAL <> () returnType:kotlin.reflect.KFunction2<<root>.Z, kotlin.Any?, kotlin.Boolean>
correspondingProperty: PROPERTY name:equals visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -32,6 +32,6 @@ value class Z {
}
val equals: KFunction2<Z, Any?, Boolean>
field = Any::equals
field = Z::equals
get