[NI] Report unsafe invoke properly for flexible types

`isNullable` check returns `true` for flexible types,
which leads to false positive unsafe invoke error, when
receiver for invoke's property is flexible.
^KT-30695 Fixed
This commit is contained in:
Pavel Kirpichenkov
2020-02-13 17:18:21 +03:00
parent b161839092
commit ba25b0faaf
4 changed files with 48 additions and 1 deletions
@@ -343,7 +343,7 @@ private fun KotlinResolutionCandidate.checkUnsafeImplicitInvokeAfterSafeCall(arg
}
} ?: error("Receiver kind does not match receiver argument")
if (receiverArgument.receiver.stableType.isNullable()) {
if (receiverArgument.isSafeCall && receiverArgument.receiver.stableType.isNullable()) {
addDiagnostic(UnsafeCallError(argument, isForImplicitInvoke = true))
return ImplicitInvokeCheckStatus.UNSAFE_INVOKE_REPORTED
}