K2 LL API: implement automatic diagnostic suppression

This commit is contained in:
Mikhail Glukhikh
2022-07-21 11:41:03 +02:00
committed by Space
parent 9add6f3d55
commit 07f16ef378
5 changed files with 41 additions and 11 deletions
@@ -27,6 +27,9 @@ abstract class MutableDiagnosticContext : DiagnosticContext {
abstract class DiagnosticReporter {
abstract fun report(diagnostic: KtDiagnostic?, context: DiagnosticContext)
open fun checkAndCommitReportsOn(element: AbstractKtSourceElement, context: DiagnosticContext?) {
}
}
open class KtDiagnosticReporterWithContext(
@@ -29,11 +29,11 @@ class PendingDiagnosticsCollectorWithSuppress : BaseDiagnosticsCollector() {
}
}
fun checkAndCommitReportsOn(
override fun checkAndCommitReportsOn(
element: AbstractKtSourceElement,
context: DiagnosticContext?,
commitEverything: Boolean
context: DiagnosticContext?
) {
val commitEverything = context == null
for ((path, pendingList) in pendingDiagnosticsByFilePath) {
val committedList = _diagnosticsByFilePath.getOrPut(path) { mutableListOf() }
val iterator = pendingList.iterator()