Simplify canBeCalledWith function

This commit is contained in:
Roman Golyshev
2020-07-10 13:14:20 +03:00
committed by Ilya Kirillov
parent b90503decb
commit e3778d62e3
@@ -76,8 +76,8 @@ private object KotlinHighLevelApiContributor : CompletionProvider<CompletionPara
}
private fun KtCallableSymbol.canBeCalledWith(implicitReceivers: List<KtType>): Boolean {
require(this is KtPossibleExtensionSymbol && this.isExtension) { "This function should be called only on extensions!" }
val requiredReceiverType = (this as? KtPossibleExtensionSymbol)?.receiverType
?: error("Extension receiver type should be present on ${this}")
val requiredReceiverType = receiverType ?: error("Receiver type should be present")
return implicitReceivers.any { it.isSubTypeOf(requiredReceiverType) }
}