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:
committed by
Nikolay Krasko
parent
75beaa861f
commit
e99dc0f87f
@@ -22,6 +22,7 @@ import com.intellij.psi.PsiFile;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public abstract class AbstractDiagnostic<E extends PsiElement> implements ParametrizedDiagnostic<E> {
|
public abstract class AbstractDiagnostic<E extends PsiElement> implements ParametrizedDiagnostic<E> {
|
||||||
private final E psiElement;
|
private final E psiElement;
|
||||||
@@ -71,4 +72,19 @@ public abstract class AbstractDiagnostic<E extends PsiElement> implements Parame
|
|||||||
if (!getFactory().isValid(this)) return false;
|
if (!getFactory().isValid(this)) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
AbstractDiagnostic<?> that = (AbstractDiagnostic<?>) o;
|
||||||
|
return Objects.equals(psiElement, that.psiElement) &&
|
||||||
|
Objects.equals(factory, that.factory) &&
|
||||||
|
severity == that.severity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(psiElement, factory, severity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ package org.jetbrains.kotlin.diagnostics;
|
|||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class DiagnosticWithParameters1<E extends PsiElement, A> extends AbstractDiagnostic<E> {
|
public class DiagnosticWithParameters1<E extends PsiElement, A> extends AbstractDiagnostic<E> {
|
||||||
private final A a;
|
private final A a;
|
||||||
|
|
||||||
@@ -48,4 +50,18 @@ public class DiagnosticWithParameters1<E extends PsiElement, A> extends Abstract
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return getFactory() + "(a = " + a + ")";
|
return getFactory() + "(a = " + a + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
if (!super.equals(o)) return false;
|
||||||
|
DiagnosticWithParameters1<?, ?> that = (DiagnosticWithParameters1<?, ?>) o;
|
||||||
|
return Objects.equals(a, that.a);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(super.hashCode(), a);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ package org.jetbrains.kotlin.diagnostics;
|
|||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class DiagnosticWithParameters2<E extends PsiElement, A, B> extends AbstractDiagnostic<E> {
|
public class DiagnosticWithParameters2<E extends PsiElement, A, B> extends AbstractDiagnostic<E> {
|
||||||
private final A a;
|
private final A a;
|
||||||
private final B b;
|
private final B b;
|
||||||
@@ -56,4 +58,19 @@ public class DiagnosticWithParameters2<E extends PsiElement, A, B> extends Abstr
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return getFactory() + "(a = " + a + ", b = " + b + ")";
|
return getFactory() + "(a = " + a + ", b = " + b + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
if (!super.equals(o)) return false;
|
||||||
|
DiagnosticWithParameters2<?, ?, ?> that = (DiagnosticWithParameters2<?, ?, ?>) o;
|
||||||
|
return Objects.equals(a, that.a) &&
|
||||||
|
Objects.equals(b, that.b);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(super.hashCode(), a, b);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ package org.jetbrains.kotlin.diagnostics;
|
|||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class DiagnosticWithParameters3<E extends PsiElement, A, B, C> extends AbstractDiagnostic<E> {
|
public class DiagnosticWithParameters3<E extends PsiElement, A, B, C> extends AbstractDiagnostic<E> {
|
||||||
private final A a;
|
private final A a;
|
||||||
private final B b;
|
private final B b;
|
||||||
@@ -64,4 +66,20 @@ public class DiagnosticWithParameters3<E extends PsiElement, A, B, C> extends Ab
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return getFactory() + "(a = " + a + ", b = " + b + ", c = " + c + ")";
|
return getFactory() + "(a = " + a + ", b = " + b + ", c = " + c + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
if (!super.equals(o)) return false;
|
||||||
|
DiagnosticWithParameters3<?, ?, ?, ?> that = (DiagnosticWithParameters3<?, ?, ?, ?>) o;
|
||||||
|
return Objects.equals(a, that.a) &&
|
||||||
|
Objects.equals(b, that.b) &&
|
||||||
|
Objects.equals(c, that.c);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(super.hashCode(), a, b, c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -247,7 +247,7 @@ fun case_4(value_1: Any?) {
|
|||||||
case_4_2(<!TYPE_MISMATCH!>value_1<!>)
|
case_4_2(<!TYPE_MISMATCH!>value_1<!>)
|
||||||
<!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!>toByte()
|
<!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!>toByte()
|
||||||
case_4_3(<!DEBUG_INFO_CONSTANT, TYPE_MISMATCH!>value_1<!>)
|
case_4_3(<!DEBUG_INFO_CONSTANT, TYPE_MISMATCH!>value_1<!>)
|
||||||
<!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()
|
<!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS!>inv<!>()
|
||||||
}
|
}
|
||||||
|
|
||||||
// TESTCASE NUMBER: 5
|
// TESTCASE NUMBER: 5
|
||||||
@@ -340,28 +340,28 @@ fun case_8(value_1: Any?) {
|
|||||||
value_1?.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>toByte<!>()
|
value_1?.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>toByte<!>()
|
||||||
if (case_8_2(<!TYPE_MISMATCH!>value_1<!>)) {
|
if (case_8_2(<!TYPE_MISMATCH!>value_1<!>)) {
|
||||||
<!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!>toByte()
|
<!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!>toByte()
|
||||||
if (case_8_3(<!DEBUG_INFO_CONSTANT, TYPE_MISMATCH!>value_1<!>)) <!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()
|
if (case_8_3(<!DEBUG_INFO_CONSTANT, TYPE_MISMATCH!>value_1<!>)) <!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS!>inv<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!case_8_4(value_1)) {
|
if (!case_8_4(value_1)) {
|
||||||
value_1?.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>toByte<!>()
|
value_1?.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>toByte<!>()
|
||||||
if (!case_8_5(<!TYPE_MISMATCH!>value_1<!>)) {
|
if (!case_8_5(<!TYPE_MISMATCH!>value_1<!>)) {
|
||||||
<!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!>toByte()
|
<!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!>toByte()
|
||||||
if (!case_8_6(<!DEBUG_INFO_CONSTANT, TYPE_MISMATCH!>value_1<!>)) <!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()
|
if (!case_8_6(<!DEBUG_INFO_CONSTANT, TYPE_MISMATCH!>value_1<!>)) <!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS!>inv<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (case_8_7(value_1) == null) {
|
if (case_8_7(value_1) == null) {
|
||||||
value_1?.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>toByte<!>()
|
value_1?.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>toByte<!>()
|
||||||
if (case_8_8(<!TYPE_MISMATCH!>value_1<!>) != null) {
|
if (case_8_8(<!TYPE_MISMATCH!>value_1<!>) != null) {
|
||||||
<!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!>toByte()
|
<!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!>toByte()
|
||||||
if (case_8_9(<!DEBUG_INFO_CONSTANT, TYPE_MISMATCH!>value_1<!>) != null) <!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()
|
if (case_8_9(<!DEBUG_INFO_CONSTANT, TYPE_MISMATCH!>value_1<!>) != null) <!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS!>inv<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (case_8_10(value_1) != null) {
|
if (case_8_10(value_1) != null) {
|
||||||
value_1?.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>toByte<!>()
|
value_1?.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>toByte<!>()
|
||||||
if (case_8_11(<!TYPE_MISMATCH!>value_1<!>) == null) {
|
if (case_8_11(<!TYPE_MISMATCH!>value_1<!>) == null) {
|
||||||
<!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!>toByte()
|
<!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!>toByte()
|
||||||
if (case_8_12(<!DEBUG_INFO_CONSTANT, TYPE_MISMATCH!>value_1<!>) == null) <!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()
|
if (case_8_12(<!DEBUG_INFO_CONSTANT, TYPE_MISMATCH!>value_1<!>) == null) <!DEBUG_INFO_CONSTANT!>value_1<!><!UNSAFE_CALL!>.<!><!MISSING_DEPENDENCY_CLASS!>inv<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ fun case_1(x: ClassWithCustomEquals) {
|
|||||||
val y = null
|
val y = null
|
||||||
if (x == <!DEBUG_INFO_CONSTANT!>y<!>) {
|
if (x == <!DEBUG_INFO_CONSTANT!>y<!>) {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ fun case_1(x: ClassWithCustomEquals) {
|
|||||||
fun case_2(x: ClassWithCustomEquals) {
|
fun case_2(x: ClassWithCustomEquals) {
|
||||||
if (<!SENSELESS_COMPARISON!>x == null<!>) {
|
if (<!SENSELESS_COMPARISON!>x == null<!>) {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ fun case_2(x: ClassWithCustomEquals) {
|
|||||||
fun case_3(x: ClassWithCustomEquals, y: Nothing?) {
|
fun case_3(x: ClassWithCustomEquals, y: Nothing?) {
|
||||||
if (x == <!DEBUG_INFO_CONSTANT!>y<!>) {
|
if (x == <!DEBUG_INFO_CONSTANT!>y<!>) {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ fun case_4(x: ClassWithCustomEquals) {
|
|||||||
val y = null
|
val y = null
|
||||||
if (<!DEBUG_INFO_CONSTANT!>y<!> == x) {
|
if (<!DEBUG_INFO_CONSTANT!>y<!> == x) {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ fun case_4(x: ClassWithCustomEquals) {
|
|||||||
fun case_5(x: ClassWithCustomEquals, y: Nothing?) {
|
fun case_5(x: ClassWithCustomEquals, y: Nothing?) {
|
||||||
if (<!DEBUG_INFO_CONSTANT!>y<!> == x) {
|
if (<!DEBUG_INFO_CONSTANT!>y<!> == x) {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ fun case_6(x: ClassWithCustomEquals) {
|
|||||||
val y = null
|
val y = null
|
||||||
if (x == <!DEBUG_INFO_CONSTANT!>y<!> == true) {
|
if (x == <!DEBUG_INFO_CONSTANT!>y<!> == true) {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ fun case_6(x: ClassWithCustomEquals) {
|
|||||||
fun case_7(x: ClassWithCustomEquals) {
|
fun case_7(x: ClassWithCustomEquals) {
|
||||||
if ((<!SENSELESS_COMPARISON!>x != null<!>) == false) {
|
if ((<!SENSELESS_COMPARISON!>x != null<!>) == false) {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ fun case_7(x: ClassWithCustomEquals) {
|
|||||||
fun case_8(x: ClassWithCustomEquals, y: Nothing?) {
|
fun case_8(x: ClassWithCustomEquals, y: Nothing?) {
|
||||||
if (!(<!DEBUG_INFO_CONSTANT!>y<!> == x) == false) {
|
if (!(<!DEBUG_INFO_CONSTANT!>y<!> == x) == false) {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-11
@@ -14,7 +14,7 @@
|
|||||||
fun case_1(x: Any?) {
|
fun case_1(x: Any?) {
|
||||||
if (x is Nothing) {
|
if (x is Nothing) {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any? & kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any? & kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ fun case_1(x: Any?) {
|
|||||||
fun case_2(x: Any) {
|
fun case_2(x: Any) {
|
||||||
if (x is Nothing) {
|
if (x is Nothing) {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ fun case_2(x: Any) {
|
|||||||
fun case_3(x: Any?) {
|
fun case_3(x: Any?) {
|
||||||
if (x !is Nothing) else {
|
if (x !is Nothing) else {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any? & kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any? & kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ fun case_3(x: Any?) {
|
|||||||
fun case_4(x: Any) {
|
fun case_4(x: Any) {
|
||||||
if (x !is Nothing) else {
|
if (x !is Nothing) else {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ fun case_4(x: Any) {
|
|||||||
fun case_5(x: Any?) {
|
fun case_5(x: Any?) {
|
||||||
if (!(x !is Nothing?)) {
|
if (!(x !is Nothing?)) {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>?.<!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>?.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ fun case_5(x: Any?) {
|
|||||||
fun case_6(x: Any?) {
|
fun case_6(x: Any?) {
|
||||||
if (!(x !is Nothing)) {
|
if (!(x !is Nothing)) {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any? & kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any? & kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ fun case_6(x: Any?) {
|
|||||||
fun case_7(x: Any) {
|
fun case_7(x: Any) {
|
||||||
if (!(x is Nothing)) else {
|
if (!(x is Nothing)) else {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ fun case_7(x: Any) {
|
|||||||
fun case_8(x: Any?) {
|
fun case_8(x: Any?) {
|
||||||
if (!(x is Nothing?)) else {
|
if (!(x is Nothing?)) else {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>?.<!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>?.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ fun case_8(x: Any?) {
|
|||||||
fun case_9(x: Any?) {
|
fun case_9(x: Any?) {
|
||||||
if (!!(x !is Nothing?)) else {
|
if (!!(x !is Nothing?)) else {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>?.<!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>?.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ fun case_9(x: Any?) {
|
|||||||
fun case_10(x: Any?) {
|
fun case_10(x: Any?) {
|
||||||
if (!!(x !is Nothing)) else {
|
if (!!(x !is Nothing)) else {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any? & kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any? & kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>x<!>.<!UNREACHABLE_CODE!><!MISSING_DEPENDENCY_CLASS!>inv<!>()<!>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,6 +94,6 @@ fun case_10(x: Any?) {
|
|||||||
fun case_11(x: Any?) {
|
fun case_11(x: Any?) {
|
||||||
if (x is Nothing?) {
|
if (x is Nothing?) {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>?.<!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>?.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@ fun case_1(x: Nothing?) {
|
|||||||
fun case_2(x: Nothing) {
|
fun case_2(x: Nothing) {
|
||||||
if (<!USELESS_IS_CHECK!>x <!UNREACHABLE_CODE!>is Unit<!><!>) <!UNREACHABLE_CODE!>{
|
if (<!USELESS_IS_CHECK!>x <!UNREACHABLE_CODE!>is Unit<!><!>) <!UNREACHABLE_CODE!>{
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>x<!>
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>x<!>
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>x<!>.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
|
||||||
}<!>
|
}<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ fun case_7(x: Nothing) {
|
|||||||
fun case_8(x: Nothing?) {
|
fun case_8(x: Nothing?) {
|
||||||
if (!(<!USELESS_IS_CHECK!><!DEBUG_INFO_CONSTANT!>x<!> is Int?<!>)) else {
|
if (!(<!USELESS_IS_CHECK!><!DEBUG_INFO_CONSTANT!>x<!> is Int?<!>)) else {
|
||||||
<!DEBUG_INFO_CONSTANT, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
|
<!DEBUG_INFO_CONSTANT, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
|
||||||
<!DEBUG_INFO_CONSTANT, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>?.<!MISSING_DEPENDENCY_CLASS, MISSING_DEPENDENCY_CLASS!>inv<!>()
|
<!DEBUG_INFO_CONSTANT, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>?.<!MISSING_DEPENDENCY_CLASS!>inv<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ fun case_1(x: Any?) {
|
|||||||
fun case_2(x: Any?) {
|
fun case_2(x: Any?) {
|
||||||
(x as Nothing?)!!
|
(x as Nothing?)!!
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?"), UNREACHABLE_CODE!>x<!>
|
<!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
|
// TESTCASE NUMBER: 3
|
||||||
@@ -48,7 +48,7 @@ fun case_4(x: Any?) {
|
|||||||
fun case_5(x: Any?) {
|
fun case_5(x: Any?) {
|
||||||
if (x as Nothing? is Nothing) {
|
if (x as Nothing? is Nothing) {
|
||||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
|
<!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<!>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ open class KotlinPsiChecker : Annotator, HighlightRangeExtension {
|
|||||||
protected open fun shouldSuppressUnusedParameter(parameter: KtParameter): Boolean = false
|
protected open fun shouldSuppressUnusedParameter(parameter: KtParameter): Boolean = false
|
||||||
|
|
||||||
fun annotateElement(element: PsiElement, holder: AnnotationHolder, diagnostics: Diagnostics) {
|
fun annotateElement(element: PsiElement, holder: AnnotationHolder, diagnostics: Diagnostics) {
|
||||||
val diagnosticsForElement = diagnostics.forElement(element)
|
val diagnosticsForElement = diagnostics.forElement(element).toSet()
|
||||||
|
|
||||||
if (element is KtNameReferenceExpression) {
|
if (element is KtNameReferenceExpression) {
|
||||||
val unresolved = diagnostics.any { it.factory == Errors.UNRESOLVED_REFERENCE }
|
val unresolved = diagnostics.any { it.factory == Errors.UNRESOLVED_REFERENCE }
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// OUT_OF_CODE_BLOCK: FALSE
|
// OUT_OF_CODE_BLOCK: FALSE
|
||||||
// ERROR: This variable must either have a type annotation or be initialized
|
// ERROR: This variable must either have a type annotation or be initialized
|
||||||
// ERROR: Type mismatch: inferred type is Unit but Int? was expected
|
// ERROR: Type mismatch: inferred type is Unit but Int? was expected
|
||||||
// ERROR: Type mismatch: inferred type is Unit but Int? was expected
|
|
||||||
|
|
||||||
val test: Int? = if (true) {
|
val test: Int? = if (true) {
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
Reference in New Issue
Block a user