Add new SENSELESS_COMPARISON in FIR foreign annotation tests

This commit is contained in:
Mikhail Glukhikh
2021-08-09 15:12:33 +03:00
committed by TeamCityServer
parent cdc0f36859
commit 85a2a3255d
3 changed files with 3 additions and 48 deletions
@@ -83,11 +83,11 @@ fun evlis() {
fun ifChecksAndSmartCasts() {
// JSR
val r1 = if (a == null) 42 else a.length
val r1 = if (<!SENSELESS_COMPARISON!>a == null<!>) 42 else a.length
val r2 = if (b == null) 42 else b.length
// JB
val r3 = if (c == null) 42 else c.length
val r3 = if (<!SENSELESS_COMPARISON!>c == null<!>) 42 else c.length
val r4 = if (d == null) 42 else d.length
// Platform
@@ -1,46 +0,0 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
// JSR305_GLOBAL_REPORT: warn
// FILE: spr/NonNullApi.java
package spr;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.annotation.Nonnull;
import javax.annotation.meta.TypeQualifierDefault;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Nonnull
@TypeQualifierDefault({ElementType.METHOD, ElementType.PARAMETER})
public @interface NonNullApi {
}
// FILE: A.java
import spr.*;
@NonNullApi
public class A {
public String getBar() {
return "";
}
}
// FILE: main.kt
fun main(a: A) {
if (a.getBar() == "1" && a.hashCode() != 0) return
if (a.getBar() != "2" && a.hashCode() != 0) return
if (a.getBar() == null && a.hashCode() != 0) return
if (a.getBar() != null && a.hashCode() != 0) return
if (a.bar == "1" && a.hashCode() != 0) return
if (a.bar != "2" && a.hashCode() != 0) return
if (a.bar == null && a.hashCode() != 0) return
if (a.bar != null && a.hashCode() != 0) return
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
// JSR305_GLOBAL_REPORT: warn