Step 7d complete: exhaustive match checking + evaluator cleanup
Match exhaustiveness analysis: - check-match-exhaustiveness function in evaluator.sx - lint-node in tree-tools.sx checks match forms during format-check - Warns on: no wildcard/catch-all, boolean missing true/false case - (match x (true "yes")) → "match may be non-exhaustive" Evaluator cleanup: - Added missing step-sf-callcc definition (was in old transpiled output) - Added missing step-sf-case definition (was in old transpiled output) - Removed protocol functions from bootstrap skip set (they transpile fine) - Retranspiled VM (bootstrap_vm.py) for compatibility 2650 tests pass (+5 from new features). All Step 7 features complete: 7a: ->> |> as-> pipe operators 7b: Dict patterns, &rest, let-match destructuring 7c: define-protocol, implement, satisfies? 7d: Exhaustive match checking Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,7 @@ let trampoline v = !trampoline_fn v
|
||||
let _strict_ref = ref (Bool false)
|
||||
let _prim_param_types_ref = ref Nil
|
||||
let _last_error_kont_ref = ref Nil
|
||||
let _protocol_registry_ = Dict (Hashtbl.create 0)
|
||||
|
||||
"""
|
||||
|
||||
@@ -209,6 +210,15 @@ def compile_spec_to_ml(spec_dir: str | None = None) -> str:
|
||||
# the transpiler directly — it emits !_ref for reads, _ref := for writes.
|
||||
import re
|
||||
|
||||
# Remove `and _protocol_registry_ = (Dict ...)` from the let rec block —
|
||||
# it's defined in the preamble as a top-level let, and Hashtbl.create
|
||||
# is not allowed as a let rec right-hand side.
|
||||
output = re.sub(
|
||||
r'\n\(\* \*protocol-registry\*.*?\nand _protocol_registry_ =\n \(Dict \(Hashtbl\.create 0\)\)\n',
|
||||
'\n',
|
||||
output
|
||||
)
|
||||
|
||||
return output
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user