You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(parser): slice/range index e[a:b] via slice builtin (#135 slice 2) (#154)
#135 slice 2. The grammar only had `e[i]` (ExprIndex); the stdlib uses
slice syntax `list[1:]` (option.affine, collections.affine).
Rather than a new AST node (ExprIndex reaches ~20 files incl. every
codegen), `e[a:b]` / `e[a:]` / `e[:b]` / `e[:]` desugar in the parser to
the `slice` builtin: missing low = 0, missing high = `len(e)`. `slice`
is registered like `len` at the four standard points — resolve.ml
(builtin name), typecheck.ml (`a -> Int -> Int -> a`), interp.ml
(JS-`.slice` semantics: half-open, neg-from-end, clamped),
codegen_deno.ml (lowers to `.slice`).
Effect: option.affine 238 → 320, collections.affine 24 → 40 (further
distinct later-slice defects). Plain `e[i]` indexing unaffected. Two
regression tests; full suite green (225 tests).
Advances #135. Refs #128, #135.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments