Files
hakorune/apps/tests/phase29ab_pattern6_reverse_firstfail_min.hako

20 lines
457 B
Plaintext

// Phase 29ab P7: Pattern6 reverse scan first-fail (step contract violation)
// Expect: JoinIR freeze (reverse step must be i = i - 1)
static box Main {
last_index_bad_step(s, ch) {
local i = s.length() - 1
loop(i >= 0) {
if s.substring(i, i + 1) == ch {
return i
}
i = i + 1
}
return -1
}
main() {
return Main.last_index_bad_step("abc", "b")
}
}