[NI] Fix reporting UNSAFE_IMPLICIT_INVOKE_CALL diagnostic
This commit is contained in:
committed by
Mikhail Zarechenskiy
parent
251a02f71d
commit
e6deaf3315
@@ -24,6 +24,8 @@ interface KotlinCall : ResolutionAtom {
|
||||
val argumentsInParenthesis: List<KotlinCallArgument>
|
||||
|
||||
val externalArgument: KotlinCallArgument?
|
||||
|
||||
val isForImplicitInvoke: Boolean
|
||||
}
|
||||
|
||||
private fun SimpleKotlinCallArgument.checkReceiverInvariants() {
|
||||
|
||||
+6
-2
@@ -76,7 +76,9 @@ class SimpleCandidateFactory(
|
||||
fromResolution: ReceiverValueWithSmartCastInfo?
|
||||
): SimpleKotlinCallArgument? =
|
||||
explicitReceiver as? SimpleKotlinCallArgument ?: // qualifier receiver cannot be safe
|
||||
fromResolution?.let { ReceiverExpressionKotlinCallArgument(it, isSafeCall = false) } // todo smartcast implicit this
|
||||
fromResolution?.let {
|
||||
ReceiverExpressionKotlinCallArgument(it, isSafeCall = false, isForImplicitInvoke = kotlinCall.isForImplicitInvoke)
|
||||
} // todo smartcast implicit this
|
||||
|
||||
private fun KotlinCall.getExplicitDispatchReceiver(explicitReceiverKind: ExplicitReceiverKind) = when (explicitReceiverKind) {
|
||||
ExplicitReceiverKind.DISPATCH_RECEIVER -> explicitReceiver
|
||||
@@ -94,7 +96,9 @@ class SimpleCandidateFactory(
|
||||
|
||||
val explicitReceiverKind =
|
||||
if (givenCandidate.dispatchReceiver == null) ExplicitReceiverKind.NO_EXPLICIT_RECEIVER else ExplicitReceiverKind.DISPATCH_RECEIVER
|
||||
val dispatchArgumentReceiver = givenCandidate.dispatchReceiver?.let { ReceiverExpressionKotlinCallArgument(it, isSafeCall) }
|
||||
val dispatchArgumentReceiver = givenCandidate.dispatchReceiver?.let {
|
||||
ReceiverExpressionKotlinCallArgument(it, isSafeCall)
|
||||
}
|
||||
return createCandidate(
|
||||
givenCandidate.descriptor, explicitReceiverKind, dispatchArgumentReceiver, null,
|
||||
listOf(), givenCandidate.knownTypeParametersResultingSubstitutor
|
||||
|
||||
Reference in New Issue
Block a user