while body quotation allows stack pollution #233
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#233
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?
Summary
The
whilecombinator does not properly verify that its body quotation is stack-neutral. A quotation like[1]that pushes a value should be rejected at compile time, but currently passes type checking.Expected Behavior
Should produce a compile-time error like:
Actual Behavior
The code compiles without error. Each loop iteration pushes an extra value onto the stack.
Root Cause
The row variable unification is too permissive. When unifying the body quotation's effect
( ..a -- ..a Int )against the expected( ..a -- ..a ), the row variable absorbs the extraIntinstead of rejecting it.Related
test_while_body_stack_neutral_gapin typechecker.rs documents this gaphttps://github.com/navicore/patch-seq/pull/236