[FIR] Implement FirReturnAllowedChecker

Supported diagnostics:
- RETURN_NOT_ALLOWED
- RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY
This commit is contained in:
Dmitriy Novozhilov
2021-04-05 10:15:21 +03:00
committed by TeamCityServer
parent 254ff77977
commit 3cb17ac2f0
59 changed files with 263 additions and 343 deletions
@@ -1,4 +1,4 @@
fun <T> simpleRun(f: (T) -> Unit): Unit = f(return)
fun <T> simpleRun(f: (T) -> Unit): Unit = f(<!RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY!>return<!>)
fun <T, R> List<T>.simpleMap(f: (T) -> R): R {
@@ -0,0 +1,10 @@
FILE: labeledReturnFromNotLabeledUnnamedFunction.kt
public final fun notInline(block: R|(kotlin/Boolean) -> kotlin/Unit|): R|kotlin/String| {
^notInline String()
}
public final fun test(): R|kotlin/String| {
^test R|/notInline|(fun <anonymous>(b: R|kotlin/Boolean|): R|kotlin/Unit| <inline=NoInline> {
^@notInline Unit
}
)
}
@@ -0,0 +1,9 @@
fun notInline(block: (Boolean) -> Unit): String {
return ""
}
fun test(): String {
return notInline(fun(b: Boolean) {
return@notInline
})
}