K2: Do not use KFunctionN as representation type for adapted references
Beside some corner cases, it's already prohibited in K1 because adaptation have a bit strange nature (they don't represent any existing real function exactly) ^KT-55137 Fixed
This commit is contained in:
committed by
Space Team
parent
dcdc48a233
commit
a38040680c
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// SKIP_TXT
|
||||
fun foo(x: String = "O"): String = x
|
||||
fun bar(x: String = "K"): String = x
|
||||
|
||||
fun dump(dumpStrategy: String) {
|
||||
val k0: kotlin.reflect.KFunction0<String> = <!INAPPLICABLE_CANDIDATE!>returnAdapter<!>(::<!UNRESOLVED_REFERENCE!>foo<!>) // Error: ADAPTED_CALLABLE_REFERENCE_AGAINST_REFLECTION_TYPE
|
||||
val k1: kotlin.reflect.KFunction0<String> = ::<!UNRESOLVED_REFERENCE!>foo<!>
|
||||
// Should be error here, too
|
||||
val k2: kotlin.reflect.KFunction0<String> = if (dumpStrategy == "KotlinLike") ::<!UNRESOLVED_REFERENCE!>foo<!> else ::<!UNRESOLVED_REFERENCE!>bar<!>
|
||||
|
||||
val f0: Function0<String> = <!INAPPLICABLE_CANDIDATE!>returnAdapter<!>(::<!UNRESOLVED_REFERENCE!>foo<!>)
|
||||
val f1: Function0<String> = ::foo
|
||||
val f2: Function0<String> = if (dumpStrategy == "KotlinLike") ::<!UNRESOLVED_REFERENCE!>foo<!> else ::<!UNRESOLVED_REFERENCE!>bar<!>
|
||||
}
|
||||
|
||||
fun returnAdapter(a: kotlin.reflect.KFunction0<String>) = a
|
||||
Reference in New Issue
Block a user