Fix intention for when: insert '||' instead of ','

This commit is contained in:
Natalia Ukhorskaya
2015-12-16 14:58:43 +03:00
parent 6a3ac66208
commit abd7ed5c70
7 changed files with 46 additions and 30 deletions
@@ -1,6 +1,6 @@
fun test(n: Int): String {
return <caret>when {
n < 0, n > 1000 -> "unknown"
n < 0 || n > 1000 -> "unknown"
n <= 10 -> "small"
n <= 100 -> "average"
else -> "big"
@@ -1,5 +1,6 @@
// ERROR: Expected condition of type kotlin.Boolean
// ERROR: Expected condition of type kotlin.Boolean
// SKIP_ERRORS_AFTER
fun test(n: Int): String {
return <caret>when {
@@ -1,5 +1,6 @@
// ERROR: Expected condition of type kotlin.Boolean
// ERROR: Expected condition of type kotlin.Boolean
// SKIP_ERRORS_AFTER
fun test(n: Int): String {
return if (_ is String) "String"
@@ -1,8 +1,8 @@
fun test(n: Int): String {
return <caret>when {
n in 0..5, n in 5..10 -> "small"
n in 10..50, n in 50..100 -> "average"
n in 100..500, n in 500..1000 -> "big"
return when {
n in 0..5 || n in 5..10 -> "small"
n in 10..50 || n in 50..100 -> "average"
n in 100..500 || n in 500..1000 -> "big"
else -> "unknown"
}
}