K2 JVM: Take JVM declarations conflicting error back

Since SimpleDiagnosticsCollectorWithSuppress have been replaced by
PendingDiagnosticsCollectorWithSuppress after commit 9add6f3d55,
diagnostics need to be committed now.

#KT-54366 Fixed
This commit is contained in:
Xin Wang
2022-10-09 14:24:39 +08:00
committed by Space Team
parent 51619e0969
commit 69a4de0461
6 changed files with 52 additions and 1 deletions
@@ -38,6 +38,10 @@ open class KtDiagnosticReporterWithContext(
) : DiagnosticReporter() {
override fun report(diagnostic: KtDiagnostic?, context: DiagnosticContext) = diagnosticReporter.report(diagnostic, context)
override fun checkAndCommitReportsOn(element: AbstractKtSourceElement, context: DiagnosticContext?) {
diagnosticReporter.checkAndCommitReportsOn(element, context)
}
open fun at(sourceElement: AbstractKtSourceElement?, containingFilePath: String): DiagnosticContextImpl =
DiagnosticContextImpl(sourceElement, containingFilePath)
@@ -81,6 +85,13 @@ open class KtDiagnosticReporterWithContext(
sourceElement?.let { report(factory.on(it, a1, a2, positioningStrategy), this) }
}
fun <A : Any> reportAndCommit(factory: KtDiagnosticFactory1<A>, a: A) {
sourceElement?.let {
reportOn(it, factory, a, this)
checkAndCommitReportsOn(it, this)
}
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is DiagnosticContextImpl) return false