Reflection: do not try to box COROUTINE_SUSPENDED

#KT-58887 Fixed
This commit is contained in:
Alexander Udalov
2023-08-15 18:54:59 +02:00
committed by Space Team
parent bd6af5cc42
commit a58a1a3398
8 changed files with 71 additions and 0 deletions
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.types.asSimpleType
import java.lang.reflect.Member
import java.lang.reflect.Method
import java.lang.reflect.Type
import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED
import kotlin.reflect.jvm.internal.KDeclarationContainerImpl
import kotlin.reflect.jvm.internal.KotlinReflectionInternalError
import kotlin.reflect.jvm.internal.defaultPrimitiveValue
@@ -186,6 +187,7 @@ internal class ValueClassAwareCaller<out M : Member?>(
}
val result = caller.call(unboxedArguments)
if (result === COROUTINE_SUSPENDED) return result
// box is not null only for inline classes
return box?.invoke(null, result) ?: result