Skip to content

fix: accept mixed indices for buffer access#620

Open
nahime0 wants to merge 1 commit into
mainfrom
fix/497-buffer-t-indexing-rejects-mixed-index
Open

fix: accept mixed indices for buffer access#620
nahime0 wants to merge 1 commit into
mainfrom
fix/497-buffer-t-indexing-rejects-mixed-index

Conversation

@nahime0

@nahime0 nahime0 commented Jul 24, 2026

Copy link
Copy Markdown
Member

Summary

  • Allow buffer<T> reads and writes to accept Mixed indices produced by non-constant integer arithmetic.
  • Narrow buffer read indices from Mixed to Int in EIR before backend bounds and address checks.
  • Add end-to-end regression coverage and an Unreleased changelog entry.

Context

Checked integer addition, subtraction, and multiplication produce a boxed Mixed result so they can promote to float on
overflow. Buffer indexing still required a statically concrete Int, causing these indices to fail during type checking or EIR
backend lowering.

Buffer writes already performed the appropriate EIR coercion. This change makes reads follow the same target-neutral path while
allowing Mixed indices through the checker for both operations.

Fixes #497

Testing

  • cargo build
  • cargo test --test codegen_tests codegen::buffers:: — 15 passed
  • cargo test --test error_tests buffer_ — 16 passed
  • git diff --check

@github-actions github-actions Bot added area:eir Touches EIR definitions, lowering, validation, or passes. area:types Touches type checking, inference, or compatibility. size:s Small pull request. type:fix Corrects broken or incompatible behavior. labels Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:eir Touches EIR definitions, lowering, validation, or passes. area:types Touches type checking, inference, or compatibility. size:s Small pull request. type:fix Corrects broken or incompatible behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

buffer<T> indexing rejects Mixed index (int-overflow promotion breaks arithmetic-derived buffer indices)

1 participant