feat(normalization): Phase 142 P0 - Loop statement-level normalization
Phase 142-loopstmt P0: Statement-level normalization 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
29
apps/tests/phase139_if_only_post_k_return_add_min.hako
Normal file
29
apps/tests/phase139_if_only_post_k_return_add_min.hako
Normal file
@ -0,0 +1,29 @@
|
||||
// Phase 139 P0: if-only post_k return add minimal fixture
|
||||
//
|
||||
// Purpose: Ensure post_if_post_k.rs delegates return lowering to ReturnValueLowererBox
|
||||
// Pattern:
|
||||
// x = 1
|
||||
// flag = 1
|
||||
// if flag == 1 { x = 2 } else { x = 1 }
|
||||
// return x + 2
|
||||
// Expected: exit code 4
|
||||
//
|
||||
// Notes:
|
||||
// - Requires explicit else (Phase 129-C contract for post_if_post_k)
|
||||
// - Dev-only Normalized shadow path (NYASH_JOINIR_DEV=1 + HAKO_JOINIR_STRICT=1)
|
||||
|
||||
static box Main {
|
||||
main() {
|
||||
local x
|
||||
local flag
|
||||
x = 1
|
||||
flag = 1
|
||||
if flag == 1 {
|
||||
x = 2
|
||||
} else {
|
||||
x = 1
|
||||
}
|
||||
return x + 2
|
||||
}
|
||||
}
|
||||
|
||||
27
apps/tests/phase141_p1_if_only_post_k_return_length_min.hako
Normal file
27
apps/tests/phase141_p1_if_only_post_k_return_length_min.hako
Normal file
@ -0,0 +1,27 @@
|
||||
// Phase 141 P1: ExprLowerer known intrinsic (length0) minimal fixture (if-only)
|
||||
//
|
||||
// Purpose: Exercise MethodCall lowering via `ReturnValueLowererBox` without loop-boundary merge.
|
||||
//
|
||||
// Pattern:
|
||||
// s = "abc"
|
||||
// flag = 1
|
||||
// if flag == 1 { s = s } else { s = s }
|
||||
// return s.length()
|
||||
//
|
||||
// Expected: exit code 3
|
||||
// Notes: Dev-only Normalized shadow path (NYASH_JOINIR_DEV=1 + HAKO_JOINIR_STRICT=1)
|
||||
|
||||
static box Main {
|
||||
main() {
|
||||
local s
|
||||
local flag
|
||||
s = "abc"
|
||||
flag = 1
|
||||
if flag == 1 {
|
||||
s = s
|
||||
} else {
|
||||
s = s
|
||||
}
|
||||
return s.length()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user