K1/K2: add a test fixing behavior of overloadResolutionByLambda/PCLA combo

This commit is contained in:
Mikhail Glukhikh
2024-02-09 10:20:57 +01:00
committed by Space Team
parent 8217aa9633
commit e532220305
8 changed files with 65 additions and 0 deletions
@@ -3838,6 +3838,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/builderInference"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("overloadResolutionByLambdaReturnType.kt")
public void testOverloadResolutionByLambdaReturnType() throws Exception {
runTest("compiler/testData/diagnostics/tests/builderInference/overloadResolutionByLambdaReturnType.kt");
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/builderInference/issues")
@TestDataPath("$PROJECT_ROOT")
@@ -3838,6 +3838,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/builderInference"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("overloadResolutionByLambdaReturnType.kt")
public void testOverloadResolutionByLambdaReturnType() throws Exception {
runTest("compiler/testData/diagnostics/tests/builderInference/overloadResolutionByLambdaReturnType.kt");
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/builderInference/issues")
@TestDataPath("$PROJECT_ROOT")
@@ -3832,6 +3832,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/builderInference"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
}
@Test
@TestMetadata("overloadResolutionByLambdaReturnType.kt")
public void testOverloadResolutionByLambdaReturnType() throws Exception {
runTest("compiler/testData/diagnostics/tests/builderInference/overloadResolutionByLambdaReturnType.kt");
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/builderInference/issues")
@TestDataPath("$PROJECT_ROOT")
@@ -3838,6 +3838,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/builderInference"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true, "multiplatform");
}
@Test
@TestMetadata("overloadResolutionByLambdaReturnType.kt")
public void testOverloadResolutionByLambdaReturnType() throws Exception {
runTest("compiler/testData/diagnostics/tests/builderInference/overloadResolutionByLambdaReturnType.kt");
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/builderInference/issues")
@TestDataPath("$PROJECT_ROOT")
@@ -118,6 +118,7 @@ class FirOverloadByLambdaReturnTypeResolver(
firstAtom,
firstCandidate,
forOverloadByLambdaReturnType = true,
// we explicitly decided not to use PCLA in that case because this case didn't work before in K1
withPCLASession = false,
)
while (iterator.hasNext()) {
@@ -0,0 +1,17 @@
// WITH_STDLIB
import kotlin.experimental.ExperimentalTypeInference
@OptIn(ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
fun <E1> buildL(x: MutableList<E1>.() -> Int): Int = 1
@OptIn(ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
fun <E2> buildL(x: MutableList<E2>.() -> String): String = ""
fun main() {
<!OVERLOAD_RESOLUTION_AMBIGUITY!>buildL<!> {
<!UNRESOLVED_REFERENCE!>add<!>("")
""
}
}
@@ -0,0 +1,17 @@
// WITH_STDLIB
import kotlin.experimental.ExperimentalTypeInference
@OptIn(ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
fun <E1> buildL(x: MutableList<E1>.() -> Int): Int = 1
@OptIn(ExperimentalTypeInference::class)
@OverloadResolutionByLambdaReturnType
fun <E2> buildL(x: MutableList<E2>.() -> String): String = ""
fun main() {
<!NONE_APPLICABLE!>buildL<!> {
<!UNRESOLVED_REFERENCE!>add<!>("")
""
}
}
@@ -3838,6 +3838,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/builderInference"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
}
@Test
@TestMetadata("overloadResolutionByLambdaReturnType.kt")
public void testOverloadResolutionByLambdaReturnType() throws Exception {
runTest("compiler/testData/diagnostics/tests/builderInference/overloadResolutionByLambdaReturnType.kt");
}
@Nested
@TestMetadata("compiler/testData/diagnostics/tests/builderInference/issues")
@TestDataPath("$PROJECT_ROOT")