[PL] Special handling of function references produced by FIR

This commit is contained in:
Dmitriy Dolovov
2023-03-27 18:20:45 +02:00
committed by Space Team
parent 85b5a4521e
commit 850879375a
3 changed files with 46 additions and 1 deletions
@@ -72,3 +72,19 @@ fun referenceFunctionWithRemovedTypeParameter(): String {
*/
return listOf<Any?>(null).map<Any?, RemovedClassImpl>(::functionWithRemovedTypeParameter).joinToString()
}
abstract class StableAbstractFunctionsHolder {
abstract fun foo(): String
open fun bar(): String = "bar"
}
class StableFunctionsHolder: StableAbstractFunctionsHolder() {
override fun foo(): String = "foo"
fun baz(): String = "baz"
}
data class StableClassWithEquals(val value: Int)
fun referencingMemberFunctionFoo(sfh: StableFunctionsHolder): String = run(sfh::foo)
fun referencingMemberFunctionBar(sfh: StableFunctionsHolder): String = run(sfh::bar)
fun referencingMemberFunctionBaz(sfh: StableFunctionsHolder): String = run(sfh::baz)
fun referencingAnyEquals(any: Any): String = if ((Any::equals)(any, any)) "OK" else "FAIL"
fun referencingStableClassWithEquals(stwe: StableClassWithEquals): String = if ((StableClassWithEquals::equals)(stwe, stwe)) "OK" else "FAIL"