Files
kotlin-fork/idea/testData/inspectionsLocal/liftOut/whenToAssignment/differentVariablesWithSame.kt
T
2020-06-01 21:42:03 +09:00

18 lines
319 B
Kotlin
Vendored

// 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()
}
}