This commit is contained in:
kbkpbot 2025-08-17 11:14:53 +08:00
parent a0a564a394
commit 961877f98e

View file

@ -55,7 +55,8 @@ fn (mut c Checker) if_expr(mut node ast.IfExpr) ast.Type {
if comptime_if_multi_pass_branch {
comptime_if_has_multi_pass_branch = true
}
if !comptime_if_result && !comptime_if_has_multi_pass_branch && comptime_if_found_branch {
if !comptime_if_result && !comptime_if_has_multi_pass_branch
&& comptime_if_found_branch {
// when curr cond is false, single pass branchs, and already has a true branch:
// remove following branchs' stmts
comptime_if_multi_pass_branch = false