Files
hakorune/apps/tests/phase29ab_pattern2_loopbodylocal_min.hako

31 lines
692 B
Plaintext

// Phase 29ab P1: Pattern2 LoopBodyLocal promotion minimal case
//
// Goal:
// - Break condition uses LoopBodyLocal (digit_pos) that must be promoted
// - JoinIR -> merge path should handle A-4 DigitPos promotion
//
// Expected (before fix): FAIL/out-of-scope
// Expected (after fix): prints "2" and returns 2
static box Main {
main() {
local s = "12a"
local digits = "0123456789"
local p = 0
loop(p < s.length()) {
local ch = s.substring(p, p + 1)
local digit_pos = digits.indexOf(ch)
if digit_pos < 0 {
break
}
p = p + 1
}
print(p)
return p
}
}