FE: don't run builder inference in UNTIL_FIRST_LAMBDA mode

#KT-52927 Fixed
This commit is contained in:
Mikhail Glukhikh
2022-09-05 19:25:27 +02:00
committed by Space
parent 8ee4cf46d3
commit e02fd8f4a8
9 changed files with 59 additions and 2 deletions
@@ -14339,6 +14339,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.kt");
}
@Test
@TestMetadata("invalidateKeys.kt")
public void testInvalidateKeys() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/invalidateKeys.kt");
}
@Test
@TestMetadata("kt47744.kt")
public void testKt47744() throws Exception {
@@ -14339,6 +14339,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.kt");
}
@Test
@TestMetadata("invalidateKeys.kt")
public void testInvalidateKeys() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/invalidateKeys.kt");
}
@Test
@TestMetadata("kt47744.kt")
public void testKt47744() throws Exception {
@@ -14339,6 +14339,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.kt");
}
@Test
@TestMetadata("invalidateKeys.kt")
public void testInvalidateKeys() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/invalidateKeys.kt");
}
@Test
@TestMetadata("kt47744.kt")
public void testKt47744() throws Exception {
@@ -183,7 +183,7 @@ class ConstraintSystemCompleter(components: BodyResolveComponents, private val c
allTypeVariables: List<TypeConstructorMarker>,
analyze: (PostponedResolvedAtom) -> Unit
): Boolean {
if (completionMode == ConstraintSystemCompletionMode.PARTIAL) return false
if (completionMode != ConstraintSystemCompletionMode.FULL) return false
// If we use the builder inference anyway (if the annotation is presented), then we are already analysed builder inference lambdas
if (!languageVersionSettings.supportsFeature(LanguageFeature.UseBuilderInferenceOnlyIfNeeded)) return false
@@ -212,7 +212,7 @@ class KotlinConstraintSystemCompleter(
diagnosticsHolder: KotlinDiagnosticsHolder,
analyze: (PostponedResolvedAtom) -> Unit
): Boolean {
if (completionMode == ConstraintSystemCompletionMode.PARTIAL) return false
if (completionMode != ConstraintSystemCompletionMode.FULL) return false
val useBuilderInferenceOnlyIfNeeded = languageVersionSettings.supportsFeature(LanguageFeature.UseBuilderInferenceOnlyIfNeeded)
@@ -0,0 +1,11 @@
// WITH_STDLIB
fun foo(libraryInfoCache: LibraryInfoCache<String, String>, outdated: List<String>) {
val droppedLibraryInfos = libraryInfoCache.invalidateKeys(outdated).<!UNRESOLVED_REFERENCE!>flatMapTo<!>(hashSetOf()) { <!UNRESOLVED_REFERENCE!>it<!> }
}
class LibraryInfoCache<Key, Value> {
fun invalidateKeys(
keys: Collection<Key>,
validityCondition: ((Key, Value) -> Boolean)? = null
) {}
}
@@ -0,0 +1,11 @@
// WITH_STDLIB
fun foo(libraryInfoCache: LibraryInfoCache<String, String>, outdated: List<String>) {
val droppedLibraryInfos = libraryInfoCache.invalidateKeys(outdated).<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>flatMapTo<!>(hashSetOf()) { <!UNRESOLVED_REFERENCE!>it<!> }
}
class LibraryInfoCache<Key, Value> {
fun invalidateKeys(
keys: Collection<Key>,
validityCondition: ((Key, Value) -> Boolean)? = null
) {}
}
@@ -0,0 +1,11 @@
package
public fun foo(/*0*/ libraryInfoCache: LibraryInfoCache<kotlin.String, kotlin.String>, /*1*/ outdated: kotlin.collections.List<kotlin.String>): kotlin.Unit
public final class LibraryInfoCache</*0*/ Key, /*1*/ Value> {
public constructor LibraryInfoCache</*0*/ Key, /*1*/ Value>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final fun invalidateKeys(/*0*/ keys: kotlin.collections.Collection<Key>, /*1*/ validityCondition: ((Key, Value) -> kotlin.Boolean)? = ...): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -14345,6 +14345,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.kt");
}
@Test
@TestMetadata("invalidateKeys.kt")
public void testInvalidateKeys() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/invalidateKeys.kt");
}
@Test
@TestMetadata("kt47744.kt")
public void testKt47744() throws Exception {