Files
kotlin-fork/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt610.jet
T
Andrey Breslav 41fd43b5e5 GreatSyntacticShift: Syntax for function types, function literals, when and tuples
Bug:
fun loop(var times : Int) {
   while(times > 0) {
        val u : (value : Int) -> Unit = { // This arrow is confusing the lookahead
            System.out?.println(it)
        }
        u(times--)
   }
}
2011-12-20 22:55:25 +04:00

10 lines
337 B
Plaintext

//KT-610 Distinguish errors 'unused variable' and 'variable is assigned but never accessed'
package kt610
fun foo() {
var <!UNUSED_VARIABLE!>j<!> = 9 //'unused variable' error
var <!ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE!>i<!> = 1 //should be an error 'variable i is assigned but never accessed'
i = <!UNUSED_VALUE!>2<!>
}