Files
kotlin-fork/compiler/testData/diagnostics/testsWithStdLib/inline/inlineConstructorOfArray.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

21 lines
344 B
Kotlin
Vendored

// 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)
}