@@ -13,11 +13,14 @@ import org.jetbrains.kotlin.asJava.elements.KtLightAbstractAnnotation
13
13
import org.jetbrains.kotlin.asJava.elements.KtLightMethod
14
14
import org.jetbrains.kotlin.asJava.elements.KtLightSimpleModifierList
15
15
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
16
+ import org.jetbrains.kotlin.builtins.isSuspendFunctionType
17
+ import org.jetbrains.kotlin.builtins.isSuspendFunctionTypeOrSubtype
16
18
import org.jetbrains.kotlin.psi.KtCallableDeclaration
17
19
import org.jetbrains.kotlin.psi.KtDeclaration
18
20
import org.jetbrains.kotlin.psi.KtParameter
19
21
import org.jetbrains.kotlin.types.KotlinType
20
22
import org.jetbrains.kotlin.codegen.coroutines.SUSPEND_FUNCTION_CONTINUATION_PARAMETER
23
+ import org.jetbrains.kotlin.codegen.kotlinType
21
24
import org.jetbrains.kotlin.descriptors.*
22
25
import org.jetbrains.kotlin.load.kotlin.TypeMappingMode
23
26
import org.jetbrains.kotlin.psi.KtFunction
@@ -100,9 +103,14 @@ internal abstract class KtUltraLightParameter(
100
103
101
104
private val _type : PsiType by lazyPub {
102
105
val kotlinType = kotlinType ? : return @lazyPub PsiType .NULL
103
- val containingDescriptor = computeContainingDescriptor() ? : return @lazyPub PsiType .NULL
104
- support.mapType(this ) { typeMapper, sw ->
105
- typeMapper.writeParameterType(sw, kotlinType, containingDescriptor)
106
+
107
+ if (kotlinType.isSuspendFunctionType) {
108
+ kotlinType.asPsiType(support, TypeMappingMode .DEFAULT , this )
109
+ } else {
110
+ val containingDescriptor = computeContainingDescriptor() ? : return @lazyPub PsiType .NULL
111
+ support.mapType(this ) { typeMapper, sw ->
112
+ typeMapper.writeParameterType(sw, kotlinType, containingDescriptor)
113
+ }
106
114
}
107
115
}
108
116
0 commit comments