[FIR] Support tailrec safe-calls
^KT-63529 Fixed
This commit is contained in:
committed by
Space Team
parent
a4b7697714
commit
96db6eb94f
+3
-2
@@ -102,8 +102,9 @@ object FirTailrecFunctionChecker : FirSimpleFunctionChecker() {
|
||||
val hasMore = when (next) {
|
||||
// If exiting another function, then it means this call is inside a nested local function, in which case, it's not a tailrec call.
|
||||
is FunctionExitNode -> return next.fir != tailrecFunction
|
||||
is JumpNode, is BinaryAndExitNode, is BinaryOrExitNode, is WhenBranchResultExitNode, is WhenExitNode, is BlockExitNode ->
|
||||
next.hasMoreFollowingInstructions(tailrecFunction)
|
||||
is JumpNode, is BinaryAndExitNode, is BinaryOrExitNode, is WhenBranchResultExitNode, is WhenExitNode, is BlockExitNode,
|
||||
is ExitSafeCallNode
|
||||
-> next.hasMoreFollowingInstructions(tailrecFunction)
|
||||
else -> return true
|
||||
}
|
||||
if (hasMore) return hasMore
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
// ISSUE: KT-63529
|
||||
|
||||
private <!NO_TAIL_CALLS_FOUND!>tailrec<!> fun Context.findActivityOrNull(): Activity? {
|
||||
return mBase<!UNNECESSARY_SAFE_CALL!>?.<!><!NON_TAIL_RECURSIVE_CALL!>findActivityOrNull<!>()
|
||||
}
|
||||
abstract class Context
|
||||
open class Activity
|
||||
var mBase: Context = TODO()
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// ISSUE: KT-63529
|
||||
|
||||
private tailrec fun Context.findActivityOrNull(): Activity? {
|
||||
|
||||
Reference in New Issue
Block a user