Files
kotlin-fork/compiler/testData/diagnostics/tests/when/withSubjectVariable/reassignmentToWhenSubjectVariable.kt
T
2021-03-03 12:27:11 +03:00

12 lines
259 B
Kotlin
Vendored

// FIR_IDENTICAL
// !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<!> = ""
}
}