NI: exclude reporting of an unsafe call diagnostic for implicit invoke after safe call in cases when invoke has type parameters (make NI and OI consistent)

^KT-37579 Fixed
This commit is contained in:
Victor Petukhov
2020-03-19 14:55:46 +03:00
parent 8b330193ac
commit 3b892fe31e
7 changed files with 525 additions and 1 deletions
@@ -486,7 +486,7 @@ private fun KotlinResolutionCandidate.checkUnsafeImplicitInvokeAfterSafeCall(arg
}
} ?: error("Receiver kind does not match receiver argument")
if (receiverArgument.isSafeCall && receiverArgument.receiver.stableType.isNullable()) {
if (receiverArgument.isSafeCall && receiverArgument.receiver.stableType.isNullable() && resolvedCall.candidateDescriptor.typeParameters.isEmpty()) {
addDiagnostic(UnsafeCallError(argument, isForImplicitInvoke = true))
return ImplicitInvokeCheckStatus.UNSAFE_INVOKE_REPORTED
}