Files
kotlin-fork/compiler/testData/diagnostics/tests/regressions/kt328.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

29 lines
786 B
Plaintext

//KT-328 Local function in function literals cause exceptions
fun bar1() = {
<!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>bar1()<!>
}
fun bar2() = {
fun foo2() = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>bar2()<!>
}
//properties
//in a class
class A() {
val x = { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>x<!> }
}
//in a namespace
val x = { <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>x<!> }
//KT-787 AssertionError on code 'val x = x'
val z = <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>z<!>
//KT-329 Assertion failure on local function
fun block(f : () -> Unit) = f()
fun bar3() = block{ <!UNRESOLVED_REFERENCE!>foo3<!>() // <-- missing closing curly bracket
fun foo3() = block{ <!TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>bar3()<!> }<!SYNTAX!><!>