363b25504d
Since many labels are not present in the FIR tree, this checker is implemented as a syntax checker. Comparing with FE1.0, this change reports some REDUNDANT_LABEL_WARNING that FE1.0 has missed, especially LHS of assignments.
33 lines
578 B
Kotlin
Vendored
33 lines
578 B
Kotlin
Vendored
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
|
package o
|
|
|
|
class TestFunctionLiteral {
|
|
val sum: (Int) -> Int = { x: Int ->
|
|
sum(x - 1) + x
|
|
}
|
|
val foo: () -> Unit = l@ ({ foo() })
|
|
}
|
|
|
|
open class A(val a: A)
|
|
|
|
class TestObjectLiteral {
|
|
val obj: A = object: A(obj) {
|
|
init {
|
|
val x = obj
|
|
}
|
|
fun foo() {
|
|
val y = obj
|
|
}
|
|
}
|
|
val obj1: A = <!REDUNDANT_LABEL_WARNING!>l@<!> ( object: A(obj1) {
|
|
init {
|
|
val x = obj1
|
|
}
|
|
fun foo() = obj1
|
|
})
|
|
}
|
|
|
|
class TestOther {
|
|
val x: Int = x + 1
|
|
}
|