Refactor code in "simplify call chain" (relates to KT-28576)

This commit is contained in:
Mikhail Glukhikh
2018-11-30 14:07:44 +03:00
parent 33d89005b7
commit a3909d8e47
3 changed files with 33 additions and 40 deletions
@@ -1,7 +1,7 @@
// WITH_RUNTIME
val x = listOf(1, 2, 3).joinToString(prefix = "= ", separator = " + ") {
val sb = StringBuilder()
sb.append(it).append(" + ").append(it)
sb
val sb = StringBuilder()
sb.append(it).append(" + ").append(it)
sb
}
@@ -8,9 +8,9 @@ suspend fun myFunction(context: CoroutineContext, switch: Int): Int {
with (GlobalScope) {
when (switch) {
0 -> return withContext(Dispatchers.Default) {
val x = 123
x * x
}
val x = 123
x * x
}
1 -> return withContext(context) { -1 }
else -> return withContext(Dispatchers.Default) { 9 }
}