[FIR] Fixed CFA bug

This commit is contained in:
vldf
2020-08-17 15:41:43 +03:00
parent ac07438489
commit e2016499f3
3 changed files with 7 additions and 4 deletions
@@ -47,9 +47,9 @@ class FirControlFlowAnalyzer(session: FirSession) {
}
private fun runAssignmentCfaCheckers(graph: ControlFlowGraph, reporter: DiagnosticReporter) {
val properties = AbstractFirPropertyInitializationChecker.LocalPropertyCollector.collect(graph)
val properties = AbstractFirCfaPropertyAssignmentChecker.LocalPropertyCollector.collect(graph)
if (properties.isEmpty()) return
val data = AbstractFirPropertyInitializationChecker.DataCollector(properties).getData(graph)
val data = AbstractFirCfaPropertyAssignmentChecker.DataCollector(properties).getData(graph)
variableAssignmentCheckers.forEach { it.analyze(graph, reporter, data, properties) }
}
}
@@ -58,7 +58,10 @@ class ControlFlowAnalysisDiagnosticComponent(collector: AbstractDiagnosticCollec
}
override fun visitPropertyAccessor(propertyAccessor: FirPropertyAccessor, data: CheckerContext) {
visitFunction(propertyAccessor, data)
val graph = propertyAccessor.controlFlowGraphReference?.controlFlowGraph ?: return
runCheck {
controlFlowAnalyzer.analyzePropertyAccessor(propertyAccessor, graph, data, it)
}
}
override fun visitConstructor(constructor: FirConstructor, data: CheckerContext) {
@@ -15,7 +15,7 @@ val o = object {
p.x = 4
val z : Int
doSmth(<!UNINITIALIZED_VARIABLE, UNINITIALIZED_VARIABLE!>z<!>)
doSmth(<!UNINITIALIZED_VARIABLE!>z<!>)
}
}