Fix false positive ENCLOSING_SUSPEND_FUNCTION_FOR_SUSPEND_FUNCTION_CALL

Previously added additional processing at findEnclosingSuspendFunction
seems unnecessary anymore

^KT-43258 Fixed
This commit is contained in:
Denis.Zharkov
2021-04-12 18:14:33 +03:00
committed by TeamCityServer
parent 803d47daaa
commit 0b0a6d6ede
6 changed files with 39 additions and 27 deletions
@@ -26,7 +26,7 @@ class SuspensionPointInsideMutexLockChecker : CallChecker {
if (descriptor !is FunctionDescriptor || !descriptor.isSuspend) return
val enclosingSuspendFunctionSource =
findEnclosingSuspendFunction(context, resolvedCall.call.callElement)?.source?.getPsi() ?: return
findEnclosingSuspendFunction(context)?.source?.getPsi() ?: return
// Search for `synchronized` call
var parent = reportOn
@@ -78,4 +78,4 @@ class SuspensionPointInsideMutexLockChecker : CallChecker {
private fun reportProblem(context: CallCheckerContext, reportOn: PsiElement, resolvedCall: ResolvedCall<*>) {
context.trace.report(ErrorsJvm.SUSPENSION_POINT_INSIDE_CRITICAL_SECTION.on(reportOn, resolvedCall.resultingDescriptor))
}
}
}