PSI2IR KT-49526 function reference type approximation hack

This commit is contained in:
Dmitry Petrov
2021-12-17 16:18:11 +03:00
committed by Space
parent 9c0ea11c1b
commit 976998b56c
21 changed files with 360 additions and 1 deletions
+15
View File
@@ -0,0 +1,15 @@
FILE fqName:<root> fileName:/kt49526.kt
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Boolean
BLOCK_BODY
VAR name:ref type:kotlin.reflect.KFunction1<kotlin.Nothing, kotlin.Boolean> [val]
FUNCTION_REFERENCE 'public abstract fun contains (element: E of kotlin.collections.List): kotlin.Boolean [operator] declared in kotlin.collections.List' type=kotlin.reflect.KFunction1<kotlin.Nothing, kotlin.Boolean> origin=null reflectionTarget=<same>
$this: CALL 'public final fun plus <T> (element: T of kotlin.collections.CollectionsKt.plus): kotlin.collections.List<T of kotlin.collections.CollectionsKt.plus> [operator] declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List<kotlin.Any> origin=PLUS
<T>: kotlin.Comparable<kotlin.Nothing>
$receiver: CALL 'public final fun listOf <T> (element: T of kotlin.collections.CollectionsKt.listOf): kotlin.collections.List<T of kotlin.collections.CollectionsKt.listOf> declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List<kotlin.Char> origin=null
<T>: kotlin.Char
element: CONST Char type=kotlin.Char value='a'
element: CONST String type=kotlin.String value="-"
RETURN type=kotlin.Nothing from='public final fun test (): kotlin.Boolean declared in <root>'
CALL 'public abstract fun invoke (p1: P1 of kotlin.reflect.KFunction1): R of kotlin.reflect.KFunction1 [operator] declared in kotlin.reflect.KFunction1' type=kotlin.Boolean origin=INVOKE
$this: GET_VAR 'val ref: kotlin.reflect.KFunction1<kotlin.Nothing, kotlin.Boolean> [val] declared in <root>.test' type=kotlin.reflect.KFunction1<kotlin.Nothing, kotlin.Boolean> origin=VARIABLE_AS_FUNCTION
p1: CONST Char type=kotlin.Char value='a'
+15
View File
@@ -0,0 +1,15 @@
FILE fqName:<root> fileName:/kt49526.kt
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Boolean
BLOCK_BODY
VAR name:ref type:kotlin.reflect.KFunction1<kotlin.Nothing, kotlin.Boolean> [val]
FUNCTION_REFERENCE 'public abstract fun contains (element: E of kotlin.collections.List): kotlin.Boolean [operator] declared in kotlin.collections.List' type=kotlin.reflect.KFunction1<kotlin.Any, kotlin.Boolean> origin=null reflectionTarget=<same>
$this: CALL 'public final fun plus <T> (element: T of kotlin.collections.CollectionsKt.plus): kotlin.collections.List<T of kotlin.collections.CollectionsKt.plus> [operator] declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List<kotlin.Any> origin=PLUS
<T>: kotlin.Any
$receiver: CALL 'public final fun listOf <T> (element: T of kotlin.collections.CollectionsKt.listOf): kotlin.collections.List<T of kotlin.collections.CollectionsKt.listOf> declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List<kotlin.Char> origin=null
<T>: kotlin.Char
element: CONST Char type=kotlin.Char value='a'
element: CONST String type=kotlin.String value="-"
RETURN type=kotlin.Nothing from='public final fun test (): kotlin.Boolean declared in <root>'
CALL 'public abstract fun invoke (p1: P1 of kotlin.reflect.KFunction1): R of kotlin.reflect.KFunction1 [fake_override,operator] declared in kotlin.reflect.KFunction1' type=kotlin.Boolean origin=INVOKE
$this: GET_VAR 'val ref: kotlin.reflect.KFunction1<kotlin.Nothing, kotlin.Boolean> [val] declared in <root>.test' type=kotlin.reflect.KFunction1<kotlin.Nothing, kotlin.Boolean> origin=VARIABLE_AS_FUNCTION
p1: CONST Char type=kotlin.Char value='a'
+7
View File
@@ -0,0 +1,7 @@
// WITH_STDLIB
// SKIP_KT_DUMP
fun test(): Boolean {
val ref = (listOf('a') + "-")::contains
return ref('a')
}