3e6b42083b
When BI/incomplete call is present in return argument, it will be added to the main call-tree, leading to requirement violation in `ConstraintSystemCompleter.getOrderedAllTypeVariables` as after `FirBuilderInferenceSession.inferPostponedVariables` it will be completed, and its type variables couldn't be found anymore In K1, we actually do the same, but we are able to find type variables of such calls due to architecture difference: In K2, `getOrderedAllTypeVariables` uses FIR as the main source to lookup In K1, `getOrderedAllTypeVariables` uses resolution atom tree, where candidate/CS of the call is still available after `inferPostponedVariables` In fact, all incomplete calls were analyzed in FULL mode according to the contract of `FirBuilderInferenceSession.addPartiallyResolvedCall`. Thus, it means we normally shouldn't add them to the main call-tree, but accidentally do it as incomplete calls contain non-completed candidate This particular commit addresses the problem partially, only in cases when the expected return type for the lambda is Unit and when the incomplete call is located in the last expression of the lambda In such cases, we can skip the call from the last expression completely, since all potential calls there were analyzed in FULL mode, and couldn't introduce any useful info to the CS of the main call-tree ^KT-54294