Skip to content

fix: strengthen collection and helper typing contracts - #310

Merged
dbrattli merged 1 commit into
mainfrom
fix/strengthen-typing-contracts
Nov 12, 2026
Merged

dbrattli merged 1 commit into
mainfrom
fix/strengthen-typing-contracts

Conversation

@dbrattli

Copy link
Copy Markdown
Owner

Collection annotations allowed invalid array indexing and assignments, constrained the wrong side of Block.sum_by, and misrepresented summation results. Preserve array element types through storage and indexing overloads, constrain summable projection results, and include integer zero in empty-sum return types. For example, Block.of("one", "four").sum_by(len) is valid, while assigning a string to TypedArray[int] is rejected by type checking.

Replace unnecessary Any annotations with object, preserve flip's return type, order input type parameters before result types, and remove obsolete ignores and casts. Express Result traversal with typed composition while preserving evaluation order and error precedence. Add runtime regressions, positive and negative typing contracts, and collection reference documentation.

Verification: .venv/bin/pytest -q and PATH="$PWD/.venv/bin:$PATH" .venv/bin/pre-commit run --all-files.

@dbrattli
dbrattli merged commit cb50d28 into main Nov 12, 2026
6 checks passed
@dbrattli
dbrattli deleted the fix/strengthen-typing-contracts branch November 12, 2026 18:10
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