Generate modifier list stub under nullable type for suspend functions (KT-20185)

Otherwise there's a PSI and Stub mismatch error produced.

 #KT-20185 Fixed
This commit is contained in:
Nikolay Krasko
2017-09-11 12:08:00 +03:00
parent b9872b7651
commit 74043089ab
4 changed files with 140 additions and 9 deletions
@@ -95,10 +95,20 @@ class TypeClsStubBuilder(private val c: ClsStubBuilderContext) {
val (extensionAnnotations, notExtensionAnnotations) =
annotations.partition { it.classId.asSingleFqName() == KotlinBuiltIns.FQ_NAMES.extensionFunctionType }
createTypeAnnotationStubs(parent, type, notExtensionAnnotations)
val isExtension = extensionAnnotations.isNotEmpty()
createFunctionTypeStub(nullableTypeParent(parent, type), type, isExtension, Flags.SUSPEND_TYPE.get(type.flags))
val isSuspend = Flags.SUSPEND_TYPE.get(type.flags)
val nullableWrapper = if (isSuspend) {
val wrapper = nullableTypeParent(parent, type)
createTypeAnnotationStubs(wrapper, type, notExtensionAnnotations)
wrapper
}
else {
createTypeAnnotationStubs(parent, type, notExtensionAnnotations)
nullableTypeParent(parent, type)
}
createFunctionTypeStub(nullableWrapper, type, isExtension, isSuspend)
return
}