Files
kotlin-fork/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCodeInLocalDeclarations.fir.kt
T
Andrey Zinovyev ec4cbfef59 [FIR] UNREACHABLE_CODE diagnostic (wip)
Implementation for PSI only
2021-08-04 14:42:24 +03:00

37 lines
773 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER
fun testObject() {
object : <!UNREACHABLE_CODE!>Foo(<!>todo()<!UNREACHABLE_CODE!>)<!> {
fun foo() = 1
}
}
fun testObjectExpression() {
val <!UNUSED_VARIABLE!>a<!> = object : <!UNREACHABLE_CODE!>Foo(<!>todo()<!UNREACHABLE_CODE!>)<!> {
fun foo() = 1
}
}
fun testObjectExpression1() {
fun bar(i: Int, x: Any) {}
bar(1, object : <!UNREACHABLE_CODE!>Foo(<!>todo()<!UNREACHABLE_CODE!>)<!> {
fun foo() = 1
})
}
fun testClassDeclaration() {
class C : <!UNREACHABLE_CODE!>Foo(<!>todo()<!UNREACHABLE_CODE!>)<!> {}
bar()
}
fun testFunctionDefaultArgument() {
fun foo(x: Int = todo()) { bar() }
}
open class Foo(i: Int) {}
fun todo(): Nothing = throw Exception()
fun bar() {}