[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
@@ -0,0 +1,20 @@
// FIR_IDENTICAL
fun testArray(b: Boolean) {
Array(5) { i ->
if (b) return
i
}
throw AssertionError()
}
fun testMyArray(b: Boolean) {
MyArray(5) { i ->
if (b) <!RETURN_NOT_ALLOWED!>return<!>
i
}
throw AssertionError()
}
class MyArray<T> {
constructor(size: Int, init: (Int) -> T)
}
@@ -0,0 +1,11 @@
package
public fun testArray(/*0*/ b: kotlin.Boolean): kotlin.Unit
public fun testMyArray(/*0*/ b: kotlin.Boolean): kotlin.Unit
public final class MyArray</*0*/ T> {
public constructor MyArray</*0*/ T>(/*0*/ size: kotlin.Int, /*1*/ init: (kotlin.Int) -> T)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}