Introduce "Redundant '?: return null'" inspection
#KT-34819 Fixed
This commit is contained in:
committed by
Vladimir Dolzhenko
parent
5f1cc3b152
commit
820b8c3c54
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.RedundantElvisReturnNullInspection
|
||||
@@ -0,0 +1,5 @@
|
||||
fun foo(): Int? = null
|
||||
|
||||
fun test() : Int? {
|
||||
return foo() <caret>?: return null
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fun foo(): Int? = null
|
||||
|
||||
fun test() : Int? {
|
||||
return foo()
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// PROBLEM: none
|
||||
fun foo(): Int? = null
|
||||
|
||||
fun test() : Int? {
|
||||
val i = foo() <caret>?: return null
|
||||
return 0
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// PROBLEM: none
|
||||
fun foo(): Int? = null
|
||||
|
||||
fun test() : Int? {
|
||||
return foo() <caret>?: return 1
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// PROBLEM: none
|
||||
fun bar(): Int = 1
|
||||
|
||||
fun test() : Int? {
|
||||
return bar() <caret>?: return null // USELESS_ELVIS
|
||||
}
|
||||
Reference in New Issue
Block a user