Files
kotlin-fork/compiler/testData/diagnostics/tests/controlFlowAnalysis/referenceToPropertyInitializer.fir.kt
T
Tianyu Geng 363b25504d FIR checker: report REDUNDANT_LABEL_WARNING
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.
2021-10-25 13:51:01 +03:00

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
}