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

13 lines
285 B
Kotlin
Vendored

// FIR_IDENTICAL
fun nonlocals(b : Boolean) {
a@{
fun foo() {
if (b) {
<!RETURN_NOT_ALLOWED!>return@a<!> 1 // The label must be resolved, but an error should be reported for a non-local return
}
}
return@a 5
}
}