"map.put() to assignment": handle case with labeled return inside

So #KT-23194 Fixed
This commit is contained in:
Toshiaki Kameyama
2018-03-25 13:03:41 +03:00
committed by Mikhail Glukhikh
parent 77f62f1666
commit 3992f0215c
8 changed files with 90 additions and 5 deletions
@@ -0,0 +1,10 @@
// WITH_RUNTIME
fun test(b: Boolean) {
val map = mutableMapOf<String, () -> Unit>()
map.<caret>put("") {
if (b) {
return@put
}
}
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
fun test(b: Boolean) {
val map = mutableMapOf<String, () -> Unit>()
map[""] = put@{
if (b) {
return@put
}
}
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
fun test() {
val map = mutableMapOf<String, () -> Unit>()
map.<caret>put("") {
listOf(1).forEach {
return@forEach
}
}
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
fun test() {
val map = mutableMapOf<String, () -> Unit>()
map[""] = {
listOf(1).forEach {
return@forEach
}
}
}
@@ -0,0 +1,8 @@
// WITH_RUNTIME
fun test() {
val map = mutableMapOf<String, () -> Unit>()
map.<caret>put("") label@{
return@label
}
}
@@ -0,0 +1,8 @@
// WITH_RUNTIME
fun test() {
val map = mutableMapOf<String, () -> Unit>()
map[""] = label@{
return@label
}
}