Skip to content

fix: correct collection boundaries and parser repetition - #301

Merged
dbrattli merged 1 commit into
mainfrom
fix/collection-parser-edge-cases
Nov 12, 2026
Merged

dbrattli merged 1 commit into
mainfrom
fix/collection-parser-edge-cases

Conversation

@dbrattli

Copy link
Copy Markdown
Owner

Fix five correctness issues in collection operations and parser repetition:

  • Require both maps to contain exactly the same bindings for equality, restoring symmetry and consistency with hashing.
  • Treat changing a missing map key to NOTHING as a no-op instead of raising EffectError.
  • Stop AsyncSeq.take(n) without requesting an extra source item, including for zero items.
  • Return an empty collection for take_last(0) and preserve all elements for skip_last(0) in Block and TypedArray.
  • Evaluate parser repetition iteratively so long valid input does not overflow the stack. Reject successful repetitions that do not consume input with ValueError.

Add regression coverage and document the corrected behavior. For example, list(Block.of(1, 2, 3).take_last(0)) now returns [], and many(pchar("a"))("a" * 3000) succeeds.

Verification commands: .venv/bin/python -m pytest -q and just lint.

@dbrattli
dbrattli merged commit 8b9649e into main Nov 12, 2026
6 checks passed
@dbrattli
dbrattli deleted the fix/collection-parser-edge-cases branch November 12, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant