Transform variable-as-function calls for extension functions
In the following code example fun test(f: Any.() -> Unit) = 42.f() front-end resolves variable-as-function call for 'f' as 'invoke' with signature 'Function1<Any, Unit>#Any.() -> Unit'. However, Function1<Any, Unit> has a single 'invoke' method with signature 'Function1<Any, Unit>#(Any) -> Unit'. This didn't cause any problems with loosely typed JVM and JS back-ends. However, in IR with symbols this means a reference to non-existing declaration.
This commit is contained in:
@@ -19,9 +19,9 @@ FILE /variableAsFunctionCall.kt
|
||||
VALUE_PARAMETER value-parameter f: kotlin.String.() -> kotlin.Unit
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='test2(String.() -> Unit): Unit'
|
||||
CALL 'invoke() on String: Unit' type=kotlin.Unit origin=INVOKE
|
||||
CALL 'invoke(String): Unit' type=kotlin.Unit origin=INVOKE
|
||||
$this: GET_VAR 'value-parameter f: String.() -> Unit' type=kotlin.String.() -> kotlin.Unit origin=VARIABLE_AS_FUNCTION
|
||||
$receiver: CONST String type=kotlin.String value='hello'
|
||||
p1: CONST String type=kotlin.String value='hello'
|
||||
FUN public fun test3(): kotlin.String
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='test3(): String'
|
||||
|
||||
Reference in New Issue
Block a user