Fix diagnostics calculations for incremental analysis
This commit is contained in:
+8
-5
@@ -261,9 +261,9 @@ private class StackedCompositeBindingContextTrace(
|
||||
/**
|
||||
* All diagnostics from parentContext apart those diagnostics those belongs to the element or its descendants
|
||||
*/
|
||||
val parentDiagnosticsApartElement: List<Diagnostic> = parentContext.diagnostics.all().filter { d ->
|
||||
val parentDiagnosticsApartElement: Collection<Diagnostic> = parentContext.diagnostics.all().filter { d ->
|
||||
d.psiElement.parentsWithSelf.none { it == element }
|
||||
}.toList()
|
||||
}
|
||||
|
||||
inner class StackedCompositeBindingContext : BindingContext {
|
||||
var cachedDiagnostics: Diagnostics? = null
|
||||
@@ -279,9 +279,12 @@ private class StackedCompositeBindingContextTrace(
|
||||
|
||||
override fun getDiagnostics(): Diagnostics {
|
||||
if (cachedDiagnostics == null) {
|
||||
val diagnosticList =
|
||||
parentDiagnosticsApartElement + (this@StackedCompositeBindingContextTrace.mutableDiagnostics?.all() ?: emptyList())
|
||||
cachedDiagnostics = MergedDiagnostics(diagnosticList, parentContext.diagnostics.modificationTracker)
|
||||
val mergedDiagnostics = mutableSetOf<Diagnostic>()
|
||||
mergedDiagnostics.addAll(parentDiagnosticsApartElement)
|
||||
this@StackedCompositeBindingContextTrace.mutableDiagnostics?.all()?.let {
|
||||
mergedDiagnostics.addAll(it)
|
||||
}
|
||||
cachedDiagnostics = MergedDiagnostics(mergedDiagnostics, parentContext.diagnostics.modificationTracker)
|
||||
}
|
||||
return cachedDiagnostics!!
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user