Fix Member.getKPackage and temporarily revert functionFromStdlib.kt
This commit is contained in:
@@ -1,9 +1,6 @@
|
|||||||
// IGNORE_BACKEND: JS
|
|
||||||
// WITH_REFLECT
|
// WITH_REFLECT
|
||||||
|
|
||||||
import kotlin.reflect.KFunction1
|
fun doStuff(fn: String.() -> String) = "ok".fn()
|
||||||
|
|
||||||
fun doStuff(fn: KFunction1<String, String>) = fn.call("ok")
|
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return doStuff(String::toUpperCase)
|
return doStuff(String::toUpperCase)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
@file:JvmName("ReflectJvmMapping")
|
@file:JvmName("ReflectJvmMapping")
|
||||||
package kotlin.reflect.jvm
|
package kotlin.reflect.jvm
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||||
import org.jetbrains.kotlin.load.kotlin.reflect.ReflectKotlinClass
|
import org.jetbrains.kotlin.load.kotlin.reflect.ReflectKotlinClass
|
||||||
import java.lang.reflect.*
|
import java.lang.reflect.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -101,7 +102,11 @@ val Field.kotlinProperty: KProperty<*>?
|
|||||||
|
|
||||||
|
|
||||||
private fun Member.getKPackage(): KDeclarationContainer? =
|
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,
|
* Returns a [KFunction] instance corresponding to the given Java [Method] instance,
|
||||||
|
|||||||
Reference in New Issue
Block a user