Don't create DONT_CARE type for CR and lambdas within builder inference calls

It leads to leak such type to the back-end. Calls within a builder call should be updated without marking CR and lambdas with DONT_CARE type.

^KT-43845 Fixed
^KT-43956 Fixed
^KT-42622 Fixed
This commit is contained in:
Victor Petukhov
2020-12-23 15:28:04 +03:00
parent b4d8adeeb4
commit 0b472f858b
5 changed files with 440 additions and 1 deletions
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.resolve.*;
import org.jetbrains.kotlin.resolve.calls.components.InferenceSession;
import org.jetbrains.kotlin.resolve.calls.context.ContextDependency;
import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext;
import org.jetbrains.kotlin.resolve.calls.inference.CoroutineInferenceSession;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo;
import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValue;
import org.jetbrains.kotlin.resolve.calls.tower.KotlinResolutionCallbacksImpl;
@@ -423,7 +424,8 @@ public class ExpressionTypingServices {
@NotNull KtExpression statementExpression,
@NotNull ExpressionTypingContext context
) {
if (!context.languageVersionSettings.supportsFeature(LanguageFeature.NewInference)) return null;
if (!context.languageVersionSettings.supportsFeature(LanguageFeature.NewInference) || context.inferenceSession instanceof CoroutineInferenceSession)
return null;
KtFunctionLiteral functionLiteral = PsiUtilsKt.getNonStrictParentOfType(statementExpression, KtFunctionLiteral.class);
if (functionLiteral != null) {
KotlinResolutionCallbacksImpl.LambdaInfo info =