35 lines
760 B
Plaintext
35 lines
760 B
Plaintext
// Phase 29ab P4 / Phase 263: Pattern2 seg real-world minimal repro
|
|
//
|
|
// Goal:
|
|
// - seg is LoopBodyLocal and reassigned in the loop body
|
|
// - break condition depends on seg
|
|
// - current behavior: JoinIR freeze (read-only contract violation)
|
|
// - after fix: prints "4" and returns 4
|
|
|
|
static box Main {
|
|
main() {
|
|
local table = "a|||"
|
|
local i = 0
|
|
|
|
loop(true) {
|
|
local j = table.indexOf("|||", i)
|
|
local seg = ""
|
|
|
|
if j >= 0 {
|
|
seg = table.substring(i, j)
|
|
} else {
|
|
seg = table.substring(i, table.length())
|
|
}
|
|
|
|
if seg == "" {
|
|
break
|
|
}
|
|
|
|
i = j + 3
|
|
}
|
|
|
|
print(i)
|
|
return i
|
|
}
|
|
}
|