phase29ab(p5): freeze pattern7 split-scan near-miss with fixture+smoke

This commit is contained in:
2025-12-28 14:32:19 +09:00
parent 7a790a27cb
commit bea2a8d9bb
6 changed files with 249 additions and 14 deletions

View File

@ -0,0 +1,37 @@
// Phase 29ab P5: Pattern7 first-fail minimal (contract violation)
// Expect: JoinIR freeze (else step is not i = i + 1)
static box StringUtils {
split_bad_step(s, separator) {
local result = new ArrayBox()
if separator.length() == 0 {
result.push(s)
return result
}
local start = 0
local i = 0
loop(i <= s.length() - separator.length()) {
if s.substring(i, i + separator.length()) == separator {
result.push(s.substring(start, i))
start = i + separator.length()
i = start
} else {
i = i + 2
}
}
if start <= s.length() {
result.push(s.substring(start, s.length()))
}
return result
}
}
static box Main {
main() {
local result = StringUtils.split_bad_step("a,b,c", ",")
return result.length()
}
}