Skip to content

Commit 9e90459

Browse files
committed
Add coroutines as parameters
1 parent fc30e56 commit 9e90459

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

compiler/light-classes/src/org/jetbrains/kotlin/asJava/classes/ultraLightParameters.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ import org.jetbrains.kotlin.asJava.elements.KtLightAbstractAnnotation
1313
import org.jetbrains.kotlin.asJava.elements.KtLightMethod
1414
import org.jetbrains.kotlin.asJava.elements.KtLightSimpleModifierList
1515
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
16+
import org.jetbrains.kotlin.builtins.isSuspendFunctionType
17+
import org.jetbrains.kotlin.builtins.isSuspendFunctionTypeOrSubtype
1618
import org.jetbrains.kotlin.psi.KtCallableDeclaration
1719
import org.jetbrains.kotlin.psi.KtDeclaration
1820
import org.jetbrains.kotlin.psi.KtParameter
1921
import org.jetbrains.kotlin.types.KotlinType
2022
import org.jetbrains.kotlin.codegen.coroutines.SUSPEND_FUNCTION_CONTINUATION_PARAMETER
23+
import org.jetbrains.kotlin.codegen.kotlinType
2124
import org.jetbrains.kotlin.descriptors.*
2225
import org.jetbrains.kotlin.load.kotlin.TypeMappingMode
2326
import org.jetbrains.kotlin.psi.KtFunction
@@ -100,9 +103,14 @@ internal abstract class KtUltraLightParameter(
100103

101104
private val _type: PsiType by lazyPub {
102105
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+
}
106114
}
107115
}
108116

idea/idea-analysis/src/org/jetbrains/kotlin/idea/caches/resolve/IDELightClassGenerationSupport.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,6 @@ class IDELightClassGenerationSupport(private val project: Project) : LightClassG
169169
}
170170
if (declaration is KtCallableDeclaration) {
171171
declaration.valueParameters.mapNotNull { findTooComplexDeclaration(it) }.firstOrNull()?.let { return it }
172-
if (declaration.typeReference?.hasModifier(KtTokens.SUSPEND_KEYWORD) == true) {
173-
return declaration.typeReference
174-
}
175172
}
176173
if (declaration is KtProperty) {
177174
declaration.accessors.mapNotNull { findTooComplexDeclaration(it) }.firstOrNull()?.let { return it }

0 commit comments

Comments
 (0)