Lift assignment out: do not report when assignment variables are different

#KT-38649 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-04-30 13:38:30 +09:00
committed by Yan Zhulanow
parent 498c40548b
commit 5efbbdea57
3 changed files with 27 additions and 1 deletions
@@ -0,0 +1,18 @@
// PROBLEM: none
// WITH_RUNTIME
class A {
val list: MutableList<String> = mutableListOf()
}
class B {
val list: MutableList<String> = mutableListOf()
}
fun Any.add(s: String) {
<caret>when (this) {
is A -> list += s
is B -> list += s
else -> throw IllegalStateException()
}
}