[FE 1.0] Don't try to report specialized resolution ambiguity error for builder inference if the corresponding substitutor is empty

^KT-50989 Fixed
This commit is contained in:
Victor Petukhov
2022-01-27 11:33:31 +03:00
committed by teamcity
parent eeadd8588d
commit 1a23cd8c45
8 changed files with 43 additions and 2 deletions
@@ -14059,6 +14059,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt49829.kt");
}
@Test
@TestMetadata("kt50989.kt")
public void testKt50989() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt50989.kt");
}
@Test
@TestMetadata("labaledCall.kt")
public void testLabaledCall() throws Exception {
@@ -14059,6 +14059,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt49829.kt");
}
@Test
@TestMetadata("kt50989.kt")
public void testKt50989() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt50989.kt");
}
@Test
@TestMetadata("labaledCall.kt")
public void testLabaledCall() throws Exception {
@@ -14059,6 +14059,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt49829.kt");
}
@Test
@TestMetadata("kt50989.kt")
public void testKt50989() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt50989.kt");
}
@Test
@TestMetadata("labaledCall.kt")
public void testLabaledCall() throws Exception {
@@ -76,8 +76,8 @@ class ResolutionWithStubTypesChecker(private val kotlinCallResolver: KotlinCallR
val builderInferenceSession = lambda.builderInferenceSession as BuilderInferenceSession
val stubVariablesSubstitutor = builderInferenceSession.getNotFixedToInferredTypesSubstitutor()
val variablesForUsedStubTypes = builderInferenceSession.getUsedStubTypes().map { it.originalTypeVariable }
val typeVariablesSubstitutionMap = (builderInferenceSession.getCurrentSubstitutor() as NewTypeSubstitutorByConstructorMap).map
.filterKeys { it in variablesForUsedStubTypes }
val substitutor = builderInferenceSession.getCurrentSubstitutor() as? NewTypeSubstitutorByConstructorMap ?: return
val typeVariablesSubstitutionMap = substitutor.map.filterKeys { it in variablesForUsedStubTypes }
val newReceiverArgument = receiverValue?.buildSubstitutedReceiverArgument(stubVariablesSubstitutor, context)
val newArguments = valueArguments.replaceTypes(context, resolutionCallbacks) { _, type ->
@@ -0,0 +1,7 @@
// WITH_STDLIB
fun main() {
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildList<!> {
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(get(0))
}
}
@@ -0,0 +1,7 @@
// WITH_STDLIB
fun main() {
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildList<!> {
<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE, OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(get(0))
}
}
@@ -0,0 +1,3 @@
package
public fun main(): kotlin.Unit
@@ -14065,6 +14065,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt49829.kt");
}
@Test
@TestMetadata("kt50989.kt")
public void testKt50989() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt50989.kt");
}
@Test
@TestMetadata("labaledCall.kt")
public void testLabaledCall() throws Exception {