pyvm: implement TypeOp(check) + strict match-guard smokes; parser: guard support in match; llvm: PHI wiring at block head + incoming normalization; docs: AGENTS LLVM/PHI + guard policy; add tests; plan: refactor parse_box_declaration + TODO triage + clone reduction + CLI split + LLVM builder split; update CURRENT_TASK.md
This commit is contained in:
12
apps/tests/match_guard_lit_basic.nyash
Normal file
12
apps/tests/match_guard_lit_basic.nyash
Normal file
@ -0,0 +1,12 @@
|
||||
static box Main {
|
||||
main(args) {
|
||||
local d = 1
|
||||
local r = match d {
|
||||
1 if (0 == 1) => { print("no") 7 }
|
||||
1 => { print("yes") 9 }
|
||||
_ => 0
|
||||
}
|
||||
return r
|
||||
}
|
||||
}
|
||||
|
||||
13
apps/tests/match_guard_type_basic.nyash
Normal file
13
apps/tests/match_guard_type_basic.nyash
Normal file
@ -0,0 +1,13 @@
|
||||
static box Main {
|
||||
main(args) {
|
||||
local x = "hello"
|
||||
// Expect to match type arm and pass guard (length > 3)
|
||||
local r = match x {
|
||||
StringBox(s) if s.length() > 3 => { print("gt3") 1 }
|
||||
StringBox(s) if s.length() > 10 => { print("gt10") 2 }
|
||||
_ => { print("other") 0 }
|
||||
}
|
||||
return r
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user