Supported "is" in when entry condition
This commit is contained in:
+6
@@ -238,6 +238,12 @@ private class Processor(
|
||||
return true
|
||||
}
|
||||
|
||||
is KtWhenConditionIsPattern -> {
|
||||
//TODO: smart cast is possible outside of when or inside other branches!
|
||||
usePlainSearch(typeRefParent.parent as KtWhenEntry)
|
||||
return true
|
||||
}
|
||||
|
||||
is KtBinaryExpressionWithTypeRHS -> {
|
||||
processSuspiciousExpression(typeRefParent)
|
||||
return true
|
||||
|
||||
@@ -32,3 +32,15 @@ fun y(o: Any) {
|
||||
val list = o as List<A>
|
||||
val (x, y) = list[0]
|
||||
}
|
||||
|
||||
fun z(o: Any) {
|
||||
when (o) {
|
||||
is A -> {
|
||||
val (x, y) = o
|
||||
}
|
||||
|
||||
is String -> TODO()
|
||||
|
||||
else -> return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
[dataClass.2.kt] Value read 26 val (x, y) = o
|
||||
[dataClass.2.kt] Value read 27 val (x1, y1) = A(1, "", "")
|
||||
[dataClass.2.kt] Value read 33 val (x, y) = list[0]
|
||||
[dataClass.2.kt] Value read 39 val (x, y) = o
|
||||
[dataClass.2.kt] Value read 5 a.n
|
||||
[dataClass.2.kt] Value read 8 val (x, y, z) = a
|
||||
[dataClass.2.kt] Value read 9 val (x1, y1, z1) = f()
|
||||
|
||||
Reference in New Issue
Block a user