Files
kotlin-fork/compiler/testData/diagnostics/tests/when/withSubjectVariable/reassignmentToWhenSubjectVariable.kt
T
2018-06-20 14:06:34 +03:00

11 lines
242 B
Kotlin
Vendored

// !LANGUAGE: +VariableDeclarationInWhenSubject
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VALUE
fun foo(): Any = 42
fun test1(x: Any) {
when (val y = foo()) {
is String -> <!VAL_REASSIGNMENT!>y<!> = ""
}
}