Checking for unsupported return's
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
// ERROR: Cannot perform refactoring.\nInline Function is not supported for functions with multiple return statements.
|
||||
|
||||
fun <caret>f(p1: Int, p2: Int): Int {
|
||||
if (p1 > 0) {
|
||||
return p2
|
||||
}
|
||||
else {
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
fun g() {
|
||||
f(1, 2)
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// ERROR: Cannot perform refactoring.\nInline Function is not supported for functions with return statements not at the end of the body.
|
||||
|
||||
fun <caret>f(p1: Int, p2: Int): Int {
|
||||
while (true) {
|
||||
if (x() > p1) return@f p2
|
||||
}
|
||||
}
|
||||
|
||||
fun x(): Int = TODO()
|
||||
|
||||
fun g() {
|
||||
f(1, 2)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fun <caret>f(list: List<String>): Boolean {
|
||||
return list.any {
|
||||
if (it.isEmpty()) return@any false
|
||||
it.length < 10
|
||||
}
|
||||
}
|
||||
|
||||
fun g() {
|
||||
println(f(listOf("a", "b")))
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
fun g() {
|
||||
println(listOf("a", "b").any {
|
||||
if (it.isEmpty()) return@any false
|
||||
it.length < 10
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user