parser: ?h ternary operand slots expand known-arity calls#380
Merged
Conversation
Mirror the prefix-binop operand fix from #332 to the then/else slots of the prefix-ternary family (`?=cond a b`, `?>cond a b`, ...) and the `?h cond a b` general keyword form. `parse_operand` (atom-only) is swapped for `parse_prefix_binop_operand`, so a known-arity ident followed by enough trailing operands expands into a nested Call rather than being left as a bare Ref. Before: `?h =a b sev sc "NONE"` parsed `sev` as a bare Ref and then choked on `sc "NONE"`. Workaround was to bind-first or to wrap in parens (the paren form already worked via parse_atom's LParen branch). After: the no-parens shape parses naturally. Same shadow-safe guard as the prefix-binop site - locals that shadow a user fn name still resolve via Ref because parse_prefix_binop_operand only expands when the next token can start another operand.
Pins the behaviour across tree/VM/Cranelift for every operand-slot shape that the parser fix unblocks: - `?h cond a b` then-slot and else-slot known-arity calls - both branches as calls in the same `?h` form - `?=cond a b` family with a call in the then-slot - `?>cond a b` with a call in the else-slot - parenthesised `(sev sc)` remains a valid alternative - PR #330's 2-operand bool-subject `?h dbl x 0` still parses - local refs in operand slots still resolve as bare Refs Also adds `examples/ternary-call-operand.ilo` with -- run / -- out assertions so `tests/examples_engines.rs` exercises the example file across every engine and so future agents see the now-correct shape in their in-context learning examples.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
# Conflicts: # ai.txt # skills/ilo/SKILL.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes security-researcher + scientific-researcher rerun9. ?h/?=/?> then/else slots now accept known-arity calls inline, no bind-first required.