until condition quotation allows wrong return type #234

Closed
opened 2026-01-11 00:17:17 +00:00 by navicore · 1 comment
navicore commented 2026-01-11 00:17:17 +00:00 (Migrated from github.com)

Summary

The until combinator does not properly verify that its condition quotation returns a Bool. A quotation like [1] that returns an Int should be rejected at compile time, but currently passes type checking.

Expected Behavior

: bad-until ( -- ) [ 1 ] until ;  // Should fail: cond returns Int, not Bool

Should produce a compile-time error like:

Type error: until condition must return Bool, got Int

Actual Behavior

The code compiles without error.

Root Cause

The row variable unification absorbs the Int instead of checking it matches the expected Bool. The signature ( ..a Q -- ..b ) with independent row variables allows the condition's actual effect to be ignored.

  • Discovered while testing #231 (Quotation effect verification)
  • Test: test_until_cond_return_type_gap in typechecker.rs documents this gap
  • Similar issue may affect while condition checking
## Summary The `until` combinator does not properly verify that its condition quotation returns a `Bool`. A quotation like `[1]` that returns an `Int` should be rejected at compile time, but currently passes type checking. ## Expected Behavior ```seq : bad-until ( -- ) [ 1 ] until ; // Should fail: cond returns Int, not Bool ``` Should produce a compile-time error like: ``` Type error: until condition must return Bool, got Int ``` ## Actual Behavior The code compiles without error. ## Root Cause The row variable unification absorbs the `Int` instead of checking it matches the expected `Bool`. The signature `( ..a Q -- ..b )` with independent row variables allows the condition's actual effect to be ignored. ## Related - Discovered while testing #231 (Quotation effect verification) - Test: `test_until_cond_return_type_gap` in typechecker.rs documents this gap - Similar issue may affect `while` condition checking
navicore commented 2026-01-11 00:42:10 +00:00 (Migrated from github.com)
https://github.com/navicore/patch-seq/pull/236
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
navicore/patch-seq#234
No description provided.