K2: introduce infrastructure for LanguageVersionSettings checkers
This commit is contained in:
committed by
Space Team
parent
ba75ee4c03
commit
8c305d6143
+5
-5
@@ -11,14 +11,14 @@ import org.jetbrains.kotlin.diagnostics.impl.SimpleDiagnosticsCollector
|
||||
import org.jetbrains.kotlin.diagnostics.impl.SimpleDiagnosticsCollectorWithSuppress
|
||||
|
||||
object DiagnosticReporterFactory {
|
||||
fun createReporter(disableSuppress: Boolean = false): BaseDiagnosticsCollector {
|
||||
fun createReporter(rawReport: (Boolean, String) -> Unit = { _, _ -> }, disableSuppress: Boolean = false): BaseDiagnosticsCollector {
|
||||
return if (disableSuppress) {
|
||||
SimpleDiagnosticsCollector()
|
||||
SimpleDiagnosticsCollector(rawReport)
|
||||
} else {
|
||||
SimpleDiagnosticsCollectorWithSuppress()
|
||||
SimpleDiagnosticsCollectorWithSuppress(rawReport)
|
||||
}
|
||||
}
|
||||
|
||||
fun createPendingReporter(): PendingDiagnosticsCollectorWithSuppress =
|
||||
PendingDiagnosticsCollectorWithSuppress()
|
||||
fun createPendingReporter(rawReport: (Boolean, String) -> Unit = { _, _ -> }): PendingDiagnosticsCollectorWithSuppress =
|
||||
PendingDiagnosticsCollectorWithSuppress(rawReport)
|
||||
}
|
||||
+2
@@ -12,4 +12,6 @@ abstract class BaseDiagnosticsCollector : DiagnosticReporter() {
|
||||
abstract val diagnostics: List<KtDiagnostic>
|
||||
abstract val diagnosticsByFilePath: Map<String?, List<KtDiagnostic>>
|
||||
abstract val hasErrors: Boolean
|
||||
|
||||
abstract val rawReport: (Boolean, String) -> Unit
|
||||
}
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticContext
|
||||
import org.jetbrains.kotlin.diagnostics.KtDiagnostic
|
||||
import org.jetbrains.kotlin.diagnostics.Severity
|
||||
|
||||
class PendingDiagnosticsCollectorWithSuppress : BaseDiagnosticsCollector() {
|
||||
class PendingDiagnosticsCollectorWithSuppress(override val rawReport: (Boolean, String) -> Unit) : BaseDiagnosticsCollector() {
|
||||
private val pendingDiagnosticsByFilePath: MutableMap<String?, MutableList<KtDiagnostic>> = mutableMapOf()
|
||||
private val _diagnosticsByFilePath: MutableMap<String?, MutableList<KtDiagnostic>> = mutableMapOf()
|
||||
override val diagnostics: List<KtDiagnostic>
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticContext
|
||||
import org.jetbrains.kotlin.diagnostics.KtDiagnostic
|
||||
import org.jetbrains.kotlin.diagnostics.Severity
|
||||
|
||||
class SimpleDiagnosticsCollector : BaseDiagnosticsCollector() {
|
||||
class SimpleDiagnosticsCollector(override val rawReport: (Boolean, String) -> Unit = { _, _ -> }) : BaseDiagnosticsCollector() {
|
||||
private val _diagnosticsByFilePath: MutableMap<String?, MutableList<KtDiagnostic>> = mutableMapOf()
|
||||
override val diagnostics: List<KtDiagnostic>
|
||||
get() = _diagnosticsByFilePath.flatMap { it.value }
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticContext
|
||||
import org.jetbrains.kotlin.diagnostics.KtDiagnostic
|
||||
import org.jetbrains.kotlin.diagnostics.Severity
|
||||
|
||||
class SimpleDiagnosticsCollectorWithSuppress : BaseDiagnosticsCollector() {
|
||||
class SimpleDiagnosticsCollectorWithSuppress(override val rawReport: (Boolean, String) -> Unit) : BaseDiagnosticsCollector() {
|
||||
private val _diagnosticsByFilePath: MutableMap<String?, MutableList<KtDiagnostic>> = mutableMapOf()
|
||||
override val diagnostics: List<KtDiagnostic>
|
||||
get() = _diagnosticsByFilePath.flatMap { it.value }
|
||||
|
||||
Reference in New Issue
Block a user