[NI] Properly detecting suitability of candidate for builder inference

#KT-41430 Fixed
This commit is contained in:
Dmitriy Novozhilov
2020-08-27 17:13:20 +03:00
parent b2d9e5be91
commit f247cc3165
7 changed files with 85 additions and 9 deletions
@@ -90,15 +90,9 @@ class CoroutineInferenceSession(
val dispatchReceiver = resolvedCall.dispatchReceiverArgument
return when {
extensionReceiver == null && dispatchReceiver == null -> false
extensionReceiver == null -> true
extensionReceiver.receiver.stableType.containsStubType() -> resolvedCall.candidateDescriptor.hasBuilderInferenceAnnotation()
else -> true
}
}
private fun KotlinType.containsNotFixedTypeVariable(storage: ConstraintStorage): Boolean {
return this.contains {
it.constructor in storage.notFixedTypeVariables
dispatchReceiver?.receiver?.stableType?.containsStubType() == true -> true
extensionReceiver?.receiver?.stableType?.containsStubType() == true -> resolvedCall.candidateDescriptor.hasBuilderInferenceAnnotation()
else -> false
}
}