K2: get rid of manual diagnostic suppression in checkers

This commit is contained in:
Mikhail Glukhikh
2022-07-21 11:59:50 +02:00
committed by Space
parent 07f16ef378
commit eba0e94429
31 changed files with 365 additions and 470 deletions
@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.analysis.collectors.components.AbstractDiagnosticCollectorComponent
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.resolve.SessionHolderImpl
import org.jetbrains.kotlin.name.StandardClassIds
internal abstract class FileStructureElementDiagnosticRetriever {
abstract fun retrieve(
@@ -60,6 +61,7 @@ internal class SingleNonLocalDeclarationDiagnosticRetriever(
return when {
structureElementDeclaration !is FirRegularClass -> true
structureElementDeclaration == declaration -> true
declaration.hasAnnotation(StandardClassIds.Annotations.Suppress) -> true
else -> false
}
}
@@ -4216,6 +4216,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
public void testWithSuppression() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/suppress/withSuppression.kt");
}
@Test
@TestMetadata("withSuppression2.kt")
public void testWithSuppression2() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/suppress/withSuppression2.kt");
}
}
@Nested