FIR: make KFunctionX derived from KFunction
This commit is contained in:
@@ -48,6 +48,7 @@ object StandardClassIds {
|
|||||||
val KMutableProperty1 = "KMutableProperty1".reflectId()
|
val KMutableProperty1 = "KMutableProperty1".reflectId()
|
||||||
val KProperty2 = "KProperty2".reflectId()
|
val KProperty2 = "KProperty2".reflectId()
|
||||||
val KMutableProperty2 = "KMutableProperty2".reflectId()
|
val KMutableProperty2 = "KMutableProperty2".reflectId()
|
||||||
|
val KFunction = "KFunction".reflectId()
|
||||||
|
|
||||||
val Comparable = "Comparable".baseId()
|
val Comparable = "Comparable".baseId()
|
||||||
val Number = "Number".baseId()
|
val Number = "Number".baseId()
|
||||||
|
|||||||
+12
-4
@@ -227,20 +227,28 @@ class FirBuiltinSymbolProvider(val session: FirSession, val kotlinScopeProvider:
|
|||||||
}
|
}
|
||||||
|
|
||||||
superTypeRefs += when (kind) {
|
superTypeRefs += when (kind) {
|
||||||
FunctionClassDescriptor.Kind.Function ->
|
FunctionClassDescriptor.Kind.Function -> listOf(
|
||||||
buildResolvedTypeRef {
|
buildResolvedTypeRef {
|
||||||
type = ConeClassLikeLookupTagImpl(StandardClassIds.Function)
|
type = ConeClassLikeLookupTagImpl(StandardClassIds.Function)
|
||||||
.constructClassType(arrayOf(typeArguments.last().type), isNullable = false)
|
.constructClassType(arrayOf(typeArguments.last().type), isNullable = false)
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
||||||
FunctionClassDescriptor.Kind.SuspendFunction ->
|
FunctionClassDescriptor.Kind.SuspendFunction -> listOf(
|
||||||
session.builtinTypes.anyType
|
session.builtinTypes.anyType
|
||||||
|
)
|
||||||
|
|
||||||
FunctionClassDescriptor.Kind.KFunction ->
|
FunctionClassDescriptor.Kind.KFunction -> listOf(
|
||||||
|
buildResolvedTypeRef {
|
||||||
|
type = ConeClassLikeLookupTagImpl(StandardClassIds.KFunction)
|
||||||
|
.constructClassType(arrayOf(typeArguments.last().type), isNullable = false)
|
||||||
|
},
|
||||||
createSuperType(FunctionClassDescriptor.Kind.Function)
|
createSuperType(FunctionClassDescriptor.Kind.Function)
|
||||||
|
)
|
||||||
|
|
||||||
FunctionClassDescriptor.Kind.KSuspendFunction ->
|
FunctionClassDescriptor.Kind.KSuspendFunction -> listOf(
|
||||||
createSuperType(FunctionClassDescriptor.Kind.SuspendFunction)
|
createSuperType(FunctionClassDescriptor.Kind.SuspendFunction)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
addDeclaration(
|
addDeclaration(
|
||||||
buildSimpleFunction {
|
buildSimpleFunction {
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// SKIP_SOURCEMAP_REMAPPING
|
// SKIP_SOURCEMAP_REMAPPING
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
-2
@@ -1,5 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
fun OK() {}
|
fun OK() {}
|
||||||
|
|
||||||
|
|||||||
-1
@@ -1,5 +1,4 @@
|
|||||||
// !LANGUAGE: +InlineClasses
|
// !LANGUAGE: +InlineClasses
|
||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
import kotlin.test.*
|
import kotlin.test.*
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TODO: investigate should it be ran for JS or not
|
// TODO: investigate should it be ran for JS or not
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS, NATIVE
|
// IGNORE_BACKEND: JS, NATIVE
|
||||||
|
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR, JS, NATIVE
|
// IGNORE_BACKEND: JS_IR, JS, NATIVE
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|||||||
Vendored
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JS_IR
|
// IGNORE_BACKEND: JS_IR
|
||||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||||
// IGNORE_BACKEND: JS
|
// IGNORE_BACKEND: JS
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// SKIP_JDK6
|
// SKIP_JDK6
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// SKIP_JDK6
|
// SKIP_JDK6
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|||||||
Vendored
+3
-3
@@ -17,7 +17,7 @@ fun main() {
|
|||||||
checkSubtype<KFunction2<A, Int, Unit>>(y)
|
checkSubtype<KFunction2<A, Int, Unit>>(y)
|
||||||
checkSubtype<KFunction1<A, String>>(z)
|
checkSubtype<KFunction1<A, String>>(z)
|
||||||
|
|
||||||
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><KFunction<Unit>>(x)
|
checkSubtype<KFunction<Unit>>(x)
|
||||||
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><KFunction<Unit>>(y)
|
checkSubtype<KFunction<Unit>>(y)
|
||||||
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><KFunction<String>>(z)
|
checkSubtype<KFunction<String>>(z)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -17,7 +17,7 @@ fun main() {
|
|||||||
checkSubtype<KFunction2<A, Int, Unit>>(y)
|
checkSubtype<KFunction2<A, Int, Unit>>(y)
|
||||||
checkSubtype<KFunction1<A, String>>(z)
|
checkSubtype<KFunction1<A, String>>(z)
|
||||||
|
|
||||||
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><KFunction<Unit>>(x)
|
checkSubtype<KFunction<Unit>>(x)
|
||||||
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><KFunction<Unit>>(y)
|
checkSubtype<KFunction<Unit>>(y)
|
||||||
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><KFunction<String>>(z)
|
checkSubtype<KFunction<String>>(z)
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-8
@@ -57,17 +57,17 @@ FILE fqName:<root> fileName:/funWithDefaultParametersAsKCallableStar.kt
|
|||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
FUN name:testDefaultsOnlyStar visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
FUN name:testDefaultsOnlyStar visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/useKCallableStar]>#' type=IrErrorType
|
CALL 'public final fun useKCallableStar (fn: kotlin.reflect.KCallable<*>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||||
FUNCTION_REFERENCE 'public final fun defaultsOnly (x: kotlin.String): kotlin.Int declared in <root>' type=kotlin.reflect.KFunction0<kotlin.Int> origin=null reflectionTarget=<same>
|
fn: FUNCTION_REFERENCE 'public final fun defaultsOnly (x: kotlin.String): kotlin.Int declared in <root>' type=kotlin.reflect.KFunction0<kotlin.Int> origin=null reflectionTarget=<same>
|
||||||
FUN name:testRegularAndDefaultsStar visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
FUN name:testRegularAndDefaultsStar visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/useKCallableStar]>#' type=IrErrorType
|
CALL 'public final fun useKCallableStar (fn: kotlin.reflect.KCallable<*>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||||
FUNCTION_REFERENCE 'public final fun regularAndDefaults (x1: kotlin.String, x2: kotlin.String): kotlin.Int declared in <root>' type=kotlin.reflect.KFunction1<kotlin.String, kotlin.Int> origin=null reflectionTarget=<same>
|
fn: FUNCTION_REFERENCE 'public final fun regularAndDefaults (x1: kotlin.String, x2: kotlin.String): kotlin.Int declared in <root>' type=kotlin.reflect.KFunction1<kotlin.String, kotlin.Int> origin=null reflectionTarget=<same>
|
||||||
FUN name:testVarargsStar visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
FUN name:testVarargsStar visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/useKCallableStar]>#' type=IrErrorType
|
CALL 'public final fun useKCallableStar (fn: kotlin.reflect.KCallable<*>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||||
FUNCTION_REFERENCE 'public final fun varargs (vararg xs: kotlin.String): kotlin.Int declared in <root>' type=kotlin.reflect.KFunction1<kotlin.Array<out kotlin.String>, kotlin.Int> origin=null reflectionTarget=<same>
|
fn: FUNCTION_REFERENCE 'public final fun varargs (vararg xs: kotlin.String): kotlin.Int declared in <root>' type=kotlin.reflect.KFunction1<kotlin.Array<out kotlin.String>, kotlin.Int> origin=null reflectionTarget=<same>
|
||||||
FUN name:testCtorStar visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
FUN name:testCtorStar visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||||
BLOCK_BODY
|
BLOCK_BODY
|
||||||
ERROR_CALL 'Unresolved reference: <Inapplicable(INAPPLICABLE): [/useKCallableStar]>#' type=IrErrorType
|
CALL 'public final fun useKCallableStar (fn: kotlin.reflect.KCallable<*>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
|
||||||
FUNCTION_REFERENCE 'public constructor <init> (x: kotlin.String) [primary] declared in <root>.C' type=kotlin.reflect.KFunction0<<root>.C> origin=null reflectionTarget=<same>
|
fn: FUNCTION_REFERENCE 'public constructor <init> (x: kotlin.String) [primary] declared in <root>.C' type=kotlin.reflect.KFunction0<<root>.C> origin=null reflectionTarget=<same>
|
||||||
|
|||||||
Reference in New Issue
Block a user