Files
kotlin/compiler/testData/diagnostics/tests/declarationChecks/DataFlowInMultiDeclInFor.kt
Anton Sukhonosenko 141ffa27dc val / var are now forbidden on a loop multi declaration parameter #KT-6274 Fixed
VAL_OR_VAR_ON_LOOP_MULTI_PARAMETER error added
KtValVarKeywordOwner interface added for PSIs that have getValOrVarKeyword method
2015-11-03 15:30:50 +03:00

16 lines
362 B
Kotlin
Vendored

// KT-2667 Support multi-declarations in for-loops in control flow analysis
package d
class A {
operator fun component1() = 1
operator fun component2() = 2
operator fun component3() = 3
}
fun foo(list: List<A>) {
for (<!VAL_OR_VAR_ON_LOOP_MULTI_PARAMETER!>var<!> (c1, c2, c3) in list) {
<!UNUSED_VALUE!>c1 =<!> 1
c3 + 1
}
}