Fix generic signature for KSuspendFunction types in bytecode

#KT-27560 Fixed
This commit is contained in:
Alexander Udalov
2018-11-07 18:09:25 +01:00
parent 7b0c7ec400
commit a2612c1eae
3 changed files with 46 additions and 1 deletions
@@ -647,7 +647,8 @@ public class KotlinTypeMapper {
if (classDescriptor instanceof FunctionClassDescriptor) {
FunctionClassDescriptor functionClass = (FunctionClassDescriptor) classDescriptor;
if (functionClass.hasBigArity() ||
functionClass.getFunctionKind() == FunctionClassDescriptor.Kind.KFunction) {
functionClass.getFunctionKind() == FunctionClassDescriptor.Kind.KFunction ||
functionClass.getFunctionKind() == FunctionClassDescriptor.Kind.KSuspendFunction) {
// kotlin.reflect.KFunction{n}<P1, ..., Pn, R> is mapped to kotlin.reflect.KFunction<R> (for all n), and
// kotlin.Function{n}<P1, ..., Pn, R> is mapped to kotlin.jvm.functions.FunctionN<R> (for n > 22).
// So for these classes, we need to skip all type arguments except the very last one