K2: report empty intersection warnings from completion properly

This commit is contained in:
Mikhail Glukhikh
2023-03-02 10:25:21 +01:00
committed by Space Team
parent 47fab61716
commit a3f0e429e3
12 changed files with 38 additions and 129 deletions
@@ -18325,6 +18325,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/fir/differentSinceKotlin.kt");
}
@Test
@TestMetadata("emptyIntersectionWarning.kt")
public void testEmptyIntersectionWarning() throws Exception {
runTest("compiler/testData/codegen/box/fir/emptyIntersectionWarning.kt");
}
@Test
@TestMetadata("ExtensionAlias.kt")
public void testExtensionAlias() throws Exception {
@@ -18325,6 +18325,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/fir/differentSinceKotlin.kt");
}
@Test
@TestMetadata("emptyIntersectionWarning.kt")
public void testEmptyIntersectionWarning() throws Exception {
runTest("compiler/testData/codegen/box/fir/emptyIntersectionWarning.kt");
}
@Test
@TestMetadata("ExtensionAlias.kt")
public void testExtensionAlias() throws Exception {
@@ -802,8 +802,9 @@ class FirCallCompletionResultsWriterTransformer(
return varargArgumentsExpression
}
// TODO: report warning with a checker and return true here only in case of errors
private fun FirNamedReferenceWithCandidate.hasAdditionalResolutionErrors(): Boolean =
candidate.system.errors.any { it is InferredEmptyIntersection && it.kind.isDefinitelyEmpty }
candidate.system.errors.any { it is InferredEmptyIntersection }
private fun FirNamedReferenceWithCandidate.toResolvedReference(): FirNamedReference {
val errorDiagnostic = when {