Make useless elvis diagnostic more consistent for new and old inference

Also, remove diagnostics that can be covered by usual USELESS_ELVIS diagnostic
This commit is contained in:
Mikhail Zarechenskiy
2018-04-05 16:43:52 +03:00
parent 4e11555c46
commit 612baacc25
13 changed files with 88 additions and 27 deletions
@@ -1,4 +1,3 @@
// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE
fun baz(i: Int) = i
@@ -9,7 +8,7 @@ fun nullableFun(): ((Int) -> Int)? = null
fun test() {
val x1: (Int) -> Int = bar(if (true) ::baz else ::baz)
val x2: (Int) -> Int = bar(nullableFun() ?: ::baz)
val x3: (Int) -> Int = bar(::baz <!OI;USELESS_ELVIS!><!NI;USELESS_ELVIS_ON_CALLABLE_REFERENCE!>?:<!> ::baz<!>)
val x3: (Int) -> Int = bar(::baz <!USELESS_ELVIS!>?: ::baz<!>)
val i = 0
val x4: (Int) -> Int = bar(when (i) {