Quotation effect verification - inferred vs declared #231
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
rust
technical-debt
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
navicore/patch-seq#231
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Quotation types are inferred from their bodies, but there's limited verification that the inferred effect matches what's expected by the caller.
Example
Current Behavior
Type::Quotation { effect }orType::Closure { ... }callis used, the quotation's effect is applied to current stackQuestions
Test Cases Needed
Proposed Work
bi,dip,keep, etc.) catch bad quotationsAcceptance Criteria
Test Results: Quotation Effect Verification (#231)
Added 10 tests for combinator quotation verification.
✅ Working Correctly (8 tests)
test_times_rejects_quotation_that_pushestimesrejects[1](pushes value)test_times_rejects_quotation_that_consumestimesrejects[drop](consumes value)test_while_cond_must_return_boolwhilecond must return Booltest_until_body_must_be_stack_neutraluntilbody must be stack-neutraltest_valid_while_looptest_valid_until_looptest_quotation_in_times_loop❌ GAPS FOUND (2 tests document known issues)
test_while_body_stack_neutral_gapwhilebody[1]should be rejected but passestest_until_cond_return_type_gapuntilcond[1](returns Int) should be rejected but passesRoot Cause Analysis
The gaps occur because of how row variable unification works with quotation types in combinator signatures:
When
[1]with effect(-- Int)is matched againstQuot[..a -- ..a]:..aunifies withemptyQuot[empty -- empty]Quot[empty -- Int]The issue is that quotation type matching doesn't properly verify that:
Recommendation
Create a new issue for fixing quotation type matching in combinator unification. This requires:
Quot[effect]typesSummary
timescombinator: Fully working ✅whilecombinator: Partial - cond check works, body check has gapuntilcombinator: Partial - body check works, cond check has gaphttps://github.com/navicore/patch-seq/pull/235