Files
kotlin-fork/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt10823.fir.kt
T
Dmitriy Novozhilov 3cb17ac2f0 [FIR] Implement FirReturnAllowedChecker
Supported diagnostics:
- RETURN_NOT_ALLOWED
- RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY
2021-04-06 12:30:41 +03:00

34 lines
693 B
Kotlin
Vendored

fun find2(): Any? {
fun visit(element: Any) {
<!RETURN_NOT_ALLOWED!>return@find2<!> element
}
return null
}
// For find(): AssertionError at ControlFlowInstructionsGeneratorWorker.getExitPoint()
fun find(): Any? {
object : Any() {
fun visit(element: Any) {
<!RETURN_NOT_ALLOWED!>return@find<!> element
}
}
return null
}
fun find4(): Any? {
inline fun visit(element: Any) {
<!RETURN_NOT_ALLOWED!>return@find4<!> element
}
return null
}
fun find3(): Any? {
object : Any() {
inline fun visit(element: Any) {
<!RETURN_NOT_ALLOWED!>return@find3<!> element
}
}
return null
}