tests: cross-engine regression coverage for mget m k ?? d#228
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
Persona reports going back several sessions (lines 699, 705, 926 of
ilo_assessment_feedback.md) claimmget m k??0parses asmget(m, k??0), forcing the two-stepr=mget m k;v=r??0tax on every map lookup with a default. On currentmainthe bug is gone: the arity-aware call parser landed in06477c5registersmgetwith fixed arity 2, so??falls out as infix nil-coalesce on the whole(mget m k)result, and PR #169's??Optional-unwrap symmetry closes the loop on the value side.No fix needed; what was missing was permanent coverage. This PR adds it.
Repro before / after
The supposedly-broken patterns all work today:
AST confirms the grouping:
NilCoalesce { value: Call(mget, [m, k]), default: ... }.What's in the diff
Two commits, no
src/changes.examples: mget m k ?? d one-line lookup with default —
examples/mget-default.ilowith 7-- run:/-- out:assertions covering literal key, missing key, variable key, missing variable key, text-typed value, text default, and path-access key. Picked up automatically bytests/examples_engines.rsso every engine runs it on every CI build.tests: cross-engine regression for mget m k ?? d —
tests/regression_mget_default.rswith 9 cases per engine (tree, VM, Cranelift): literal hit/miss, variable hit/miss (the exact shape from persona line 699), text hit/miss, path-access key, call-result key, parenthesised key.Adjacent finding (logged separately, not fixed here)
While writing this, I confirmed chained
mget m "a" ?? mget m "b" ?? 99does NOT parse — the right-hand side of??re-enters call-arg mode and slurps the next??as a third arg to the secondmget. Single-mgetdefaults work; only chains break. Logged as a fresh entry inilo_assessment_feedback.md; a dedicated PR can tackle it once we agree on the parser strategy.Test plan
cargo test --release --features cranelift --test regression_mget_default— 3 passed (tree + VM + Cranelift)cargo test --release --features cranelift --test examples_engines— all examples greencargo test --release --features cranelift— full suite passes, no regressionscargo fmt --all -- --checkcleancargo clippy --release --features cranelift --tests -- -D warningscleanFollow-ups
mget ?? mget ?? dparse fix (logged inilo_assessment_feedback.md).## ✅ Addressednoting06477c5+ verifier + interpreter + VM + cranelift: allow ! on Optional #169 as the fix history.