[FIR] Improve approximation of captured types

- Handle flexible types in recursion check
- Handle intersected supertypes separately
- Make check when not to approximate captured types in type argument
  position more fine-grained.
  Only apply it to case when the captured type is replaced by a star
  projection.
  All other cases are handled by recursive calls to
  approximateCapturedType

#KT-65377 Fixed
This commit is contained in:
Kirill Rakhman
2024-02-08 12:20:43 +01:00
committed by Space Team
parent 831ef0f909
commit b90598823e
8 changed files with 95 additions and 46 deletions
@@ -18059,6 +18059,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt");
}
@Test
@TestMetadata("expectedTypeHasCapturedStarArgument.kt")
public void testExpectedTypeHasCapturedStarArgument() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/expectedTypeHasCapturedStarArgument.kt");
}
@Test
@TestMetadata("expectedTypeMismatchWithInVariance.kt")
public void testExpectedTypeMismatchWithInVariance() throws Exception {
@@ -18059,6 +18059,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/dontCheckNewCapturedTypeSpecificChecksForOldOnes.kt");
}
@Test
@TestMetadata("expectedTypeHasCapturedStarArgument.kt")
public void testExpectedTypeHasCapturedStarArgument() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/capturedTypes/expectedTypeHasCapturedStarArgument.kt");
}
@Test
@TestMetadata("expectedTypeMismatchWithInVariance.kt")
public void testExpectedTypeMismatchWithInVariance() throws Exception {