[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:
+5
@@ -7957,6 +7957,11 @@ public class FirDiagnosticsSmokeTestGenerated extends AbstractFirDiagnosticsSmok
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/functionLiteralWithoutArgumentList.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericFunctionalTypeOnRHSOfPlusAssign.kt")
|
||||
public void testGenericFunctionalTypeOnRHSOfPlusAssign() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/genericFunctionalTypeOnRHSOfPlusAssign.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("higherOrderCallMissingParameters.kt")
|
||||
public void testHigherOrderCallMissingParameters() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.kt");
|
||||
|
||||
+4
-2
@@ -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.
|
||||
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun <T> Iterable<T>.filter(predicate: (T) -> Boolean): List<T> = TODO()
|
||||
operator fun <T> Collection<T>.plus(elements: Iterable<T>): List<T> = TODO()
|
||||
|
||||
fun stringCollection(): Collection<String> = TODO()
|
||||
|
||||
fun <K> test(c: Collection<K>) {
|
||||
var variants = stringCollection()
|
||||
variants += variants.filter { true }
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
package
|
||||
|
||||
public fun stringCollection(): kotlin.collections.Collection<kotlin.String>
|
||||
public fun </*0*/ K> test(/*0*/ c: kotlin.collections.Collection<K>): kotlin.Unit
|
||||
public fun </*0*/ T> kotlin.collections.Iterable<T>.filter(/*0*/ predicate: (T) -> kotlin.Boolean): kotlin.collections.List<T>
|
||||
public operator fun </*0*/ T> kotlin.collections.Collection<T>.plus(/*0*/ elements: kotlin.collections.Iterable<T>): kotlin.collections.List<T>
|
||||
@@ -7964,6 +7964,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/functionLiteralWithoutArgumentList.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericFunctionalTypeOnRHSOfPlusAssign.kt")
|
||||
public void testGenericFunctionalTypeOnRHSOfPlusAssign() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/genericFunctionalTypeOnRHSOfPlusAssign.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("higherOrderCallMissingParameters.kt")
|
||||
public void testHigherOrderCallMissingParameters() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.kt");
|
||||
|
||||
Generated
+5
@@ -7959,6 +7959,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/functionLiteralWithoutArgumentList.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericFunctionalTypeOnRHSOfPlusAssign.kt")
|
||||
public void testGenericFunctionalTypeOnRHSOfPlusAssign() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/genericFunctionalTypeOnRHSOfPlusAssign.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("higherOrderCallMissingParameters.kt")
|
||||
public void testHigherOrderCallMissingParameters() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/functionLiterals/higherOrderCallMissingParameters.kt");
|
||||
|
||||
Reference in New Issue
Block a user