K2: fix handling of synthetic calls in delegate inference

This commit is intended to avoid the second resolve of delegate when
we need to consider provideDelegate() possibility in inference.
Also here we provide correct completion of synthetic calls during
delegate inference.

#KT-58013 Fixed
This commit is contained in:
Mikhail Glukhikh
2023-04-28 09:21:36 +02:00
committed by Space Team
parent 8c8ca7bb70
commit 3964ee38be
19 changed files with 457 additions and 3 deletions
@@ -8889,6 +8889,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt");
}
@Test
@TestMetadata("elvisInDelegated.kt")
public void testElvisInDelegated() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/elvisInDelegated.kt");
}
@Test
@TestMetadata("extensionGet.kt")
public void testExtensionGet() throws Exception {
@@ -8913,6 +8919,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.kt");
}
@Test
@TestMetadata("ifInDelegated.kt")
public void testIfInDelegated() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/ifInDelegated.kt");
}
@Test
@TestMetadata("kt41952.kt")
public void testKt41952() throws Exception {
@@ -8955,12 +8967,24 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/noExpectedTypeForSupertypeConstraint.kt");
}
@Test
@TestMetadata("notNullAssertionInLocalDelegated.kt")
public void testNotNullAssertionInLocalDelegated() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/notNullAssertionInLocalDelegated.kt");
}
@Test
@TestMetadata("resultTypeOfLambdaForConventionMethods.kt")
public void testResultTypeOfLambdaForConventionMethods() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/resultTypeOfLambdaForConventionMethods.kt");
}
@Test
@TestMetadata("tryInGenerated.kt")
public void testTryInGenerated() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/tryInGenerated.kt");
}
@Test
@TestMetadata("typeOfLazyDelegatedPropertyWithObject.kt")
public void testTypeOfLazyDelegatedPropertyWithObject() throws Exception {
@@ -9055,6 +9079,18 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/noOperatorModifierOnProvideDelegate.kt");
}
@Test
@TestMetadata("notNullAssertionInLocalDelegated.kt")
public void testNotNullAssertionInLocalDelegated() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/notNullAssertionInLocalDelegated.kt");
}
@Test
@TestMetadata("onObject.kt")
public void testOnObject() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/onObject.kt");
}
@Test
@TestMetadata("overloadResolutionForSeveralProvideDelegates.kt")
public void testOverloadResolutionForSeveralProvideDelegates() throws Exception {
@@ -8889,6 +8889,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt");
}
@Test
@TestMetadata("elvisInDelegated.kt")
public void testElvisInDelegated() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/elvisInDelegated.kt");
}
@Test
@TestMetadata("extensionGet.kt")
public void testExtensionGet() throws Exception {
@@ -8913,6 +8919,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.kt");
}
@Test
@TestMetadata("ifInDelegated.kt")
public void testIfInDelegated() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/ifInDelegated.kt");
}
@Test
@TestMetadata("kt41952.kt")
public void testKt41952() throws Exception {
@@ -8955,12 +8967,24 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/noExpectedTypeForSupertypeConstraint.kt");
}
@Test
@TestMetadata("notNullAssertionInLocalDelegated.kt")
public void testNotNullAssertionInLocalDelegated() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/notNullAssertionInLocalDelegated.kt");
}
@Test
@TestMetadata("resultTypeOfLambdaForConventionMethods.kt")
public void testResultTypeOfLambdaForConventionMethods() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/resultTypeOfLambdaForConventionMethods.kt");
}
@Test
@TestMetadata("tryInGenerated.kt")
public void testTryInGenerated() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/inference/tryInGenerated.kt");
}
@Test
@TestMetadata("typeOfLazyDelegatedPropertyWithObject.kt")
public void testTypeOfLazyDelegatedPropertyWithObject() throws Exception {
@@ -9055,6 +9079,18 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/noOperatorModifierOnProvideDelegate.kt");
}
@Test
@TestMetadata("notNullAssertionInLocalDelegated.kt")
public void testNotNullAssertionInLocalDelegated() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/notNullAssertionInLocalDelegated.kt");
}
@Test
@TestMetadata("onObject.kt")
public void testOnObject() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/provideDelegate/onObject.kt");
}
@Test
@TestMetadata("overloadResolutionForSeveralProvideDelegates.kt")
public void testOverloadResolutionForSeveralProvideDelegates() throws Exception {