Mark implicit receiver as captured if the function is expression

#KT-40260 Fixed
 #KT-42280 Fixed
This commit is contained in:
Ilmir Usmanov
2020-09-30 21:00:26 +02:00
parent 3078bd7b67
commit 5e02a4efd7
10 changed files with 141 additions and 1 deletions
@@ -887,7 +887,9 @@ class ControlFlowInformationProvider private constructor(
}
instruction.next?.let { dfs(it) }
} else if (instruction.element is KtNameReferenceExpression) {
} else if (instruction.element is KtNameReferenceExpression || instruction.element is KtBinaryExpression ||
instruction.element is KtUnaryExpression
) {
val call = instruction.element.getResolvedCall(trace.bindingContext)
if (call is VariableAsFunctionResolvedCall) {
(call.variableCall.dispatchReceiver as? ExtensionReceiver)?.declarationDescriptor?.apply { markIfNeeded() }