[NI] Disable caching of LHS expression types for "+=" operators

New behavior was introduced in ab506c1579 which breaks compilation on IDE module (see test example) for new inference.

 Now we temporarily disable this optimisation. This is temporarily restriction which will be fixed once we'll have the same rules for lambdas completion

 #KT-34889 Open
This commit is contained in:
Mikhail Zarechenskiy
2019-11-13 14:03:47 +03:00
parent 4973baae4e
commit 455b9f852d
6 changed files with 36 additions and 2 deletions
@@ -21,6 +21,7 @@ import kotlin.Pair;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
import org.jetbrains.kotlin.config.LanguageFeature;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.diagnostics.Errors;
import org.jetbrains.kotlin.lexer.KtTokens;
@@ -214,8 +215,9 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
context.trace.report(UNRESOLVED_REFERENCE.on(operationSign, operationSign));
temporary.commit();
return rightInfo.clearType();
} else if (ArgumentTypeResolver.getFunctionLiteralArgumentIfAny(right, context) == null &&
ArgumentTypeResolver.getCallableReferenceExpressionIfAny(right, context) == null) {
} else if (!ArgumentTypeResolver.isFunctionLiteralOrCallableReference(right, context) &&
!context.languageVersionSettings.supportsFeature(LanguageFeature.AdditionalBuiltInsMembers)
) {
// Cache the type info for the right hand side so that we don't evaluate it twice if there is no valid plusAssign.
// We skip over function literals and references, since ArgumentTypeResolver will only resolve the shape of the
// function type before attempting to resolve the call.