Make smart casts work with variable declared in when subject
This commit is contained in:
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// !LANGUAGE: +VariableDeclarationInWhenSubject
|
||||
|
||||
fun test(x: Any?) =
|
||||
when (val y = x) {
|
||||
is String -> "String, length = ${<!DEBUG_INFO_SMARTCAST!>y<!>.length}"
|
||||
null -> "Null"
|
||||
else -> "Any, hashCode = ${<!DEBUG_INFO_SMARTCAST!>y<!>.hashCode()}"
|
||||
}
|
||||
Reference in New Issue
Block a user