Show only unique diagnostics in psi checker (KT-35578)

MissingDependencyClassChecker.collectDiagnostics now show only unique diagnostics

As per-file analyzer trace used in checker delegates to resolve session trace, diagnostics might be duplicated because of race condition:
 1. If a non-checker thread performs analyze first, diagnostics for global elements will be stored in the resolve session trace only once.
 2 If the checker threads comes to the analyze first, diagnostics will be stored in the local trace, and after that might be duplicated in the resolve session trace by other analyzers.

 #KT-35578 Fixed
This commit is contained in:
Nikolay Krasko
2019-12-02 01:01:10 +03:00
committed by Nikolay Krasko
parent 75beaa861f
commit e99dc0f87f
11 changed files with 96 additions and 30 deletions
@@ -25,7 +25,7 @@ fun case_1(x: Any?) {
fun case_2(x: Any?) {
(x as Nothing?)!!
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?"), UNREACHABLE_CODE!>x<!>
<!UNREACHABLE_CODE!><!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!><!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
<!UNREACHABLE_CODE!><!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!><!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
}
// TESTCASE NUMBER: 3
@@ -48,7 +48,7 @@ fun case_4(x: Any?) {
fun case_5(x: Any?) {
if (x as Nothing? is Nothing) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!><!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!><!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS!>inv<!>()
}
}