[FIR] Properly approximate return type of callable declarations
- approximate intersection types in all non-local declarations - approximate local types in non-private non-local declarations
This commit is contained in:
committed by
Space Team
parent
0f70635fcb
commit
01c6c7dc59
+1
-1
@@ -112,7 +112,7 @@ private fun ConeKotlinType.needLocalTypeApproximation(
|
||||
session: FirSession,
|
||||
useSitePosition: PsiElement
|
||||
): Boolean {
|
||||
if (!shouldApproximateLocalTypesOfNonLocalDeclaration(visibilityForApproximation, isInlineFunction)) return false
|
||||
if (!shouldApproximateAnonymousTypesOfNonLocalDeclaration(visibilityForApproximation, isInlineFunction)) return false
|
||||
val localTypes: List<ConeKotlinType> = if (isLocal(session)) listOf(this) else {
|
||||
typeArguments.mapNotNull {
|
||||
if (it is ConeKotlinTypeProjection && it.type.isLocal(session)) {
|
||||
|
||||
+3
-8
@@ -1,17 +1,12 @@
|
||||
[direct super types]
|
||||
A
|
||||
B
|
||||
kotlin.Any
|
||||
|
||||
[approximated direct super types]
|
||||
A
|
||||
B
|
||||
kotlin.Any
|
||||
|
||||
[all super types]
|
||||
A
|
||||
B
|
||||
kotlin.Any
|
||||
|
||||
[approximated all super types]
|
||||
A
|
||||
B
|
||||
kotlin.Any
|
||||
|
||||
|
||||
+6
@@ -38397,6 +38397,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/kt35210.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("moreOnlyInputTypes.kt")
|
||||
public void testMoreOnlyInputTypes() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/moreOnlyInputTypes.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noInferAndLowPriority.kt")
|
||||
public void testNoInferAndLowPriority() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user