phase29ab(p3): fix PromoteDecision contract and add negative smokes

This commit is contained in:
2025-12-28 10:57:55 +09:00
parent 280a5a8187
commit 84e1cd7c7b
8 changed files with 184 additions and 30 deletions

View File

@ -0,0 +1,29 @@
// Phase 29ab P3: Pattern2 LoopBodyLocal seg Freeze (read-only violation)
//
// Goal:
// - break condition uses LoopBodyLocal seg
// - seg is reassigned in the loop body (read-only contract violation)
// - Pattern2 promotion must Freeze (fail-fast)
//
// Expected: JoinIR freeze error (non-zero exit)
static box Main {
main() {
local s = "ab "
local i = 0
loop(i < s.length()) {
local seg = s.substring(i, i + 1)
if seg == " " || seg == "\t" {
break
}
seg = "x"
i = i + 1
}
print(i)
return i
}
}

View File

@ -0,0 +1,27 @@
// Phase 29ab P3: Pattern2 LoopBodyLocal seg NotApplicable (shape mismatch)
//
// Goal:
// - break condition uses no LoopBodyLocal vars
// - Pattern2 promotion should be NotApplicable and continue safely
//
// Expected: prints "2" and returns 2
static box Main {
main() {
local s = "ab "
local i = 0
loop(i < s.length()) {
local seg = s.substring(i, i + 1)
if i >= 2 {
break
}
i = i + 1
}
print(i)
return i
}
}