Changed highlighting range and attributes of useless elvis operator
This commit is contained in:
Vendored
+1
-1
@@ -8,7 +8,7 @@ fun testBinary2() {
|
||||
}
|
||||
|
||||
fun testElvis1() {
|
||||
<!USELESS_ELVIS!>todo()<!> <!UNREACHABLE_CODE!>?: ""<!>
|
||||
todo() <!USELESS_ELVIS, UNREACHABLE_CODE!>?: ""<!>
|
||||
}
|
||||
|
||||
fun testElvis2(s: String?) {
|
||||
|
||||
Vendored
+1
-1
@@ -50,6 +50,6 @@ fun test(arr: Array<Int>) {
|
||||
}
|
||||
|
||||
while (true) {
|
||||
<!USELESS_ELVIS!>break<!> <!UNREACHABLE_CODE!>?: null<!>
|
||||
break <!USELESS_ELVIS, UNREACHABLE_CODE!>?: null<!>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ fun foo() {
|
||||
val x: Int? = null
|
||||
|
||||
bar(x ?: 0)
|
||||
if (x != null) bar(<!USELESS_ELVIS!>x<!> ?: <!DEBUG_INFO_SMARTCAST!>x<!>)
|
||||
if (x != null) bar(x <!USELESS_ELVIS!>?: <!DEBUG_INFO_SMARTCAST!>x<!><!>)
|
||||
bar(<!TYPE_MISMATCH!>x<!>)
|
||||
}
|
||||
@@ -5,12 +5,12 @@ fun <T: Any?> test1(t: Any?): Any {
|
||||
}
|
||||
|
||||
fun <T: Any> test2(t: Any?): Any {
|
||||
return <!UNCHECKED_CAST, USELESS_ELVIS!>t as T<!> ?: ""
|
||||
return <!UNCHECKED_CAST!>t as T<!> <!USELESS_ELVIS!>?: ""<!>
|
||||
}
|
||||
|
||||
fun <T: Any?> test3(t: Any?): Any {
|
||||
if (t != null) {
|
||||
return <!USELESS_ELVIS!>t<!> ?: ""
|
||||
return t <!USELESS_ELVIS!>?: ""<!>
|
||||
}
|
||||
|
||||
return 1
|
||||
|
||||
+5
-5
@@ -25,21 +25,21 @@ fun test() {
|
||||
// platform type with no annotation
|
||||
val platformJ = J.staticJ
|
||||
|
||||
val v0 = platformNN <!USELESS_ELVIS!>?:<!> J()
|
||||
platformNN <!USELESS_ELVIS!>?:<!> J()
|
||||
val v0 = platformNN <!USELESS_ELVIS!>?: J()<!>
|
||||
platformNN <!USELESS_ELVIS!>?: J()<!>
|
||||
platformN ?: J()
|
||||
platformJ ?: J()
|
||||
|
||||
if (platformNN != null) {
|
||||
<!USELESS_ELVIS!>platformNN<!> ?: J()
|
||||
platformNN <!USELESS_ELVIS!>?: J()<!>
|
||||
}
|
||||
|
||||
if (platformN != null) {
|
||||
<!USELESS_ELVIS!>platformN<!> ?: J()
|
||||
platformN <!USELESS_ELVIS!>?: J()<!>
|
||||
}
|
||||
|
||||
if (platformJ != null) {
|
||||
<!USELESS_ELVIS!>platformJ<!> ?: J()
|
||||
platformJ <!USELESS_ELVIS!>?: J()<!>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -18,10 +18,10 @@ fun test() {
|
||||
// @NotNull platform type
|
||||
val platformNN = J.staticNN
|
||||
|
||||
foo(platformNN <!USELESS_ELVIS!>?:<!> "")
|
||||
foo(platformNN <!USELESS_ELVIS!>?: ""<!>)
|
||||
|
||||
val bar = Bar()
|
||||
bar(platformNN <!USELESS_ELVIS!>?:<!> "")
|
||||
bar(platformNN <!USELESS_ELVIS!>?: ""<!>)
|
||||
}
|
||||
|
||||
fun foo(a: Any) {}
|
||||
|
||||
Reference in New Issue
Block a user