[FIR] Implement FirReturnAllowedChecker
Supported diagnostics: - RETURN_NOT_ALLOWED - RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY
This commit is contained in:
committed by
TeamCityServer
parent
254ff77977
commit
3cb17ac2f0
-51
@@ -1,51 +0,0 @@
|
||||
// !LANGUAGE: +NewInference +OverloadResolutionByLambdaReturnType
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_EXPRESSION -EXPERIMENTAL_API_USAGE -EXPERIMENTAL_UNSIGNED_LITERALS
|
||||
// ISSUE: KT-11265
|
||||
|
||||
// FILE: OverloadResolutionByLambdaReturnType.kt
|
||||
|
||||
package kotlin
|
||||
|
||||
annotation class OverloadResolutionByLambdaReturnType
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
import kotlin.OverloadResolutionByLambdaReturnType
|
||||
|
||||
inline fun <T, R> Array<out T>.myFlatMap(transform: (T) -> Iterable<R>): List<R> {
|
||||
TODO()
|
||||
}
|
||||
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@JvmName("seqFlatMap")
|
||||
inline fun <T, R> Array<out T>.myFlatMap(transform: (T) -> Sequence<R>): List<R> {
|
||||
TODO()
|
||||
}
|
||||
|
||||
fun String.toList(): List<String> = null!!
|
||||
|
||||
fun test_1(a: Array<String>, b: Boolean) {
|
||||
a.myFlatMap { it.toList().ifEmpty { return } }
|
||||
a.myFlatMap {
|
||||
if (b) return
|
||||
it.toList()
|
||||
}
|
||||
}
|
||||
|
||||
fun <T, R> Array<out T>.noInlineFlatMap(transform: (T) -> Iterable<R>): List<R> {
|
||||
TODO()
|
||||
}
|
||||
|
||||
@OverloadResolutionByLambdaReturnType
|
||||
@JvmName("noInlineSeqFlatMap")
|
||||
fun <T, R> Array<out T>.noInlineFlatMap(transform: (T) -> Sequence<R>): List<R> {
|
||||
TODO()
|
||||
}
|
||||
|
||||
fun test_2(a: Array<String>, b: Boolean) {
|
||||
a.noInlineFlatMap { it.toList().ifEmpty { return } }
|
||||
a.noInlineFlatMap {
|
||||
if (b) return
|
||||
it.toList()
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference +OverloadResolutionByLambdaReturnType
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_EXPRESSION -EXPERIMENTAL_API_USAGE -EXPERIMENTAL_UNSIGNED_LITERALS
|
||||
// ISSUE: KT-11265
|
||||
|
||||
Reference in New Issue
Block a user