diff --git a/compiler/testData/codegen/box/reflection/functions/functionFromStdlib.kt b/compiler/testData/codegen/box/reflection/functions/functionFromStdlib.kt index d7365353542..231c44f208d 100644 --- a/compiler/testData/codegen/box/reflection/functions/functionFromStdlib.kt +++ b/compiler/testData/codegen/box/reflection/functions/functionFromStdlib.kt @@ -1,9 +1,6 @@ -// IGNORE_BACKEND: JS // WITH_REFLECT -import kotlin.reflect.KFunction1 - -fun doStuff(fn: KFunction1) = fn.call("ok") +fun doStuff(fn: String.() -> String) = "ok".fn() fun box(): String { return doStuff(String::toUpperCase) diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/ReflectJvmMapping.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/ReflectJvmMapping.kt index e75837773b4..6760b83e57b 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/ReflectJvmMapping.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/ReflectJvmMapping.kt @@ -17,6 +17,7 @@ @file:JvmName("ReflectJvmMapping") package kotlin.reflect.jvm +import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader import org.jetbrains.kotlin.load.kotlin.reflect.ReflectKotlinClass import java.lang.reflect.* import java.util.* @@ -101,7 +102,11 @@ val Field.kotlinProperty: KProperty<*>? private fun Member.getKPackage(): KDeclarationContainer? = - if (ReflectKotlinClass.create(declaringClass) != null) KPackageImpl(declaringClass) else null + when (ReflectKotlinClass.create(declaringClass)?.classHeader?.kind) { + KotlinClassHeader.Kind.FILE_FACADE, KotlinClassHeader.Kind.MULTIFILE_CLASS, KotlinClassHeader.Kind.MULTIFILE_CLASS_PART -> + KPackageImpl(declaringClass) + else -> null + } /** * Returns a [KFunction] instance corresponding to the given Java [Method] instance,