FIR: assume a lambda returns Unit if it ends with a non-expression
While it is theoretically useful to know that `{ while(true) {} }`
returns Nothing, CFG node deadness is not precise enough to do that: if
the entire lambda is dead, it's no longer possible to find out whether
the loop is terminating. Besides, `while (true)` and `if (true)` are
pretty much the only constructs like that anyway.
Note that this commit does not affect resolution for lambdas that end in
a Nothing-returning expression, e.g. `throw`.
This commit is contained in:
@@ -170,8 +170,8 @@ fun case_15(z: Any?) {
|
||||
return@let it as Int
|
||||
while (true) { println(1) }
|
||||
}
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>y<!>.equals(10)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>.equals(10)
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -183,8 +183,8 @@ fun case_16(z: Any?) {
|
||||
return@run this as Int
|
||||
while (true) { println(1) }
|
||||
}
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>y<!>.equals(10)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>.equals(10)
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user