[NI] Take into account return without expression in lambdas
This commit is contained in:
committed by
Mikhail Zarechenskiy
parent
17cdbcca03
commit
4963580f90
@@ -18,6 +18,16 @@ fun test2() {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO we don't see 'return@lambda' inside internal lambda when we analyze an external lambda,
|
||||
// so type information from NI is actually incorrect, see KT-18392
|
||||
fun test3() {
|
||||
run lambda@{
|
||||
run {
|
||||
return@lambda
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun testLrmFoo1(ints: List<Int>) {
|
||||
ints.forEach lit@ {
|
||||
if (it == 0) return@lit
|
||||
|
||||
@@ -29,6 +29,24 @@ FILE /nonLocalReturn.kt
|
||||
RETURN type=kotlin.Nothing from='<anonymous>(): Unit'
|
||||
GET_OBJECT 'Unit' type=kotlin.Unit
|
||||
FUNCTION_REFERENCE '<anonymous>(): Unit' type=() -> kotlin.Unit origin=LAMBDA
|
||||
FUN public fun test3(): kotlin.Unit
|
||||
BLOCK_BODY
|
||||
CALL 'run(() -> Nothing): Nothing' type=kotlin.Nothing origin=null
|
||||
<R>: Nothing
|
||||
block: BLOCK type=() -> kotlin.Nothing origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun <anonymous>(): kotlin.Nothing
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='<anonymous>(): Nothing'
|
||||
CALL 'run(() -> Nothing): Nothing' type=kotlin.Nothing origin=null
|
||||
<R>: Nothing
|
||||
block: BLOCK type=() -> kotlin.Nothing origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA local final fun <anonymous>(): kotlin.Nothing
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='<anonymous>(): Nothing'
|
||||
TYPE_OP type=kotlin.Nothing origin=IMPLICIT_CAST typeOperand=kotlin.Nothing
|
||||
GET_OBJECT 'Unit' type=kotlin.Unit
|
||||
FUNCTION_REFERENCE '<anonymous>(): Nothing' type=() -> kotlin.Nothing origin=LAMBDA
|
||||
FUNCTION_REFERENCE '<anonymous>(): Nothing' type=() -> kotlin.Nothing origin=LAMBDA
|
||||
FUN public fun testLrmFoo1(ints: kotlin.collections.List<kotlin.Int>): kotlin.Unit
|
||||
VALUE_PARAMETER value-parameter ints: kotlin.collections.List<kotlin.Int>
|
||||
BLOCK_BODY
|
||||
|
||||
Reference in New Issue
Block a user