Remove braces from 'when' entry: do not suggest when statement is lambda that has no arrow

#KT-35288 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-12-06 21:52:33 +09:00
committed by Mikhail Glukhikh
parent afc680d5c9
commit 7b1771d432
5 changed files with 39 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
// IS_APPLICABLE: false
fun test(v: Boolean): (String) -> Int {
return when (v) {
true -> <caret>{ { taskOne(it) } }
false -> { x -> taskTwo(x) }
}
}
fun taskOne(s: String) = s.length
fun taskTwo(s: String) = 42
+9
View File
@@ -0,0 +1,9 @@
fun test(v: Boolean): (String) -> Int {
return when (v) {
true -> <caret>{ { x -> taskOne(x) } }
false -> { x -> taskTwo(x) }
}
}
fun taskOne(s: String) = s.length
fun taskTwo(s: String) = 42
@@ -0,0 +1,9 @@
fun test(v: Boolean): (String) -> Int {
return when (v) {
true -> { x -> taskOne(x) }
false -> { x -> taskTwo(x) }
}
}
fun taskOne(s: String) = s.length
fun taskTwo(s: String) = 42