[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:
committed by
Space Team
parent
831ef0f909
commit
b90598823e
@@ -16,6 +16,6 @@ FILE: castToBareType.kt
|
||||
public final fun foo(firAdaptee: R|FirFunction<*>|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(symbol: R|AbstractFirBasedSymbol<*>|): R|kotlin/Unit| {
|
||||
lval firAdaptee: R|FirFunction<FirSymbolOwner<out it(FirSymbolOwner<out it(FirSymbolOwner<out it(FirSymbolOwner<out kotlin/Any?> & FirDeclaration)> & FirDeclaration)> & FirDeclaration)>>| = (R|<local>/symbol|.R|SubstitutionOverride</AbstractFirBasedSymbol.fir: R|CapturedType(*)|>| as R|FirFunction<FirSymbolOwner<out it(FirSymbolOwner<out it(FirSymbolOwner<out it(FirSymbolOwner<out kotlin/Any?> & FirDeclaration)> & FirDeclaration)> & FirDeclaration)>>|)
|
||||
lval firAdaptee: R|FirFunction<*>| = (R|<local>/symbol|.R|SubstitutionOverride</AbstractFirBasedSymbol.fir: R|CapturedType(*)|>| as R|FirFunction<*>|)
|
||||
R|/foo|(R|<local>/firAdaptee|)
|
||||
}
|
||||
|
||||
+6
@@ -18053,6 +18053,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
|
||||
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 {
|
||||
|
||||
+6
@@ -18059,6 +18059,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user