Files
kotlin-fork/compiler/testData/diagnostics/tests/senselessComparison/parenthesized.kt
T
Dmitry Petrov df6d4f358a KT-22274 report warning on labels that can't be referenced
Labels are meaningful only if they can be referenced by 'break',
'continue', or 'return' expressions.
2018-07-25 12:08:20 +03:00

23 lines
866 B
Kotlin
Vendored

fun testEquals(x: Int) {
if (<!SENSELESS_COMPARISON!>x == null<!>) {}
if (<!SENSELESS_COMPARISON!>x == (null)<!>) {}
if (<!SENSELESS_COMPARISON!>x == <!REDUNDANT_LABEL_WARNING!>foo@<!> null<!>) {}
}
fun testEqualsFlipped(x: Int) {
if (<!SENSELESS_COMPARISON!>null == x<!>) {}
if (<!SENSELESS_COMPARISON!>(null) == x<!>) {}
if (<!SENSELESS_COMPARISON!><!REDUNDANT_LABEL_WARNING!>foo@<!> null == x<!>) {}
}
fun testNotEquals(x: Int) {
if (<!SENSELESS_COMPARISON!>x != null<!>) {}
if (<!SENSELESS_COMPARISON!>x != (null)<!>) {}
if (<!SENSELESS_COMPARISON!>x != <!REDUNDANT_LABEL_WARNING!>foo@<!> null<!>) {}
}
fun testNotEqualsFlipped(x: Int) {
if (<!SENSELESS_COMPARISON!>null != x<!>) {}
if (<!SENSELESS_COMPARISON!>(null) != x<!>) {}
if (<!SENSELESS_COMPARISON!><!REDUNDANT_LABEL_WARNING!>foo@<!> null != x<!>) {}
}