Skip to content

fix(syntax): match BEAM errors for invalid bitstring units - #48

Merged
mremond merged 1 commit into
mainfrom
fm/task-90af6d72
Nov 15, 2026
Merged

mremond merged 1 commit into
mainfrom
fm/task-90af6d72

Conversation

@mremond

@mremond mremond commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Why

Bitstring segment units should fail with BEAM-compatible errors, including zero and values beyond the valid range.

What changed

  • Reports BEAM's invalid-unit message without truncating oversized integer literals.
  • Preserves existing non-one unit conflicts and valid implicit or explicit unit:1 behavior.
  • Adds direct compile-error coverage for /bitstring and /bits edge cases.

Before and after

Before: Only 24 of 64 compiler comparisons matched BEAM's diagnostic text, although all rejection outcomes already matched.

After: All 64 comparisons now match BEAM's outcomes and diagnostic text, with valid-unit native behavior unchanged.

This changes compiler diagnostics, not a graphical view; actual compiler and native-program transcripts demonstrate the result.

Checked

Live validation: Demonstrated for this version. 3 of 3 scenarios driven live in the product.

Scenario Result Evidence
Both bitstring aliases, declaration orders, construction and patterns, including zero and oversized units. ✅ Passed live 64 real Nera/BEAM compiler comparisons match outcomes and exact error text.
Direct bitstring conflict, zero bits unit and out-of-range bitstring pattern. ✅ Passed live All three public-runner fixtures passed ten consecutive runs; BEAM rejected the same files with matching messages.
Implicit units, explicit unit:1 and ordinary binary/integer controls. ✅ Passed live The same program completed exact-bit assertions natively and on BEAM with identical completion output.
  • Locked release build and strict workspace lint: Both passed on macOS arm64.
  • Complete Rust workspace suite: 2,187 passed; one release-only measurement intentionally ignored.
  • Complete native end-to-end suite: 499 passed; two external-module tests skipped.
  • Allocator and uncaught-stacktrace probes: Both passed.
  • Repeated parser and semantic test files: 161 parser tests and 262 semantic tests passed ten consecutive runs each.
  • Workflow change-map tests: 26 passed.
How it was checked

cargo build --release --locked -j 4

cargo clippy --workspace --all-targets --locked -j 4 -- -D warnings

cargo test --workspace --locked --no-fail-fast -j 4

python3 scripts/test-allocator-config.py

./target/release/nera test -j 1 --timeout 30

python3 scripts/test-stacktrace-order.py

python3 -m unittest discover -s scripts/ci -p 'test_*.py'

Ten consecutive runs of the parser test module, semantic warnings tests and three new compile-error fixtures.

Independent code and live-proof review passed.

Risk

Risk: low in every dimension.

Full risk assessment
Dimension Level Why
Blast radius low Limited to syntax diagnostics and focused regression coverage.
Behavior low Invalid input remains rejected; its diagnostic now matches BEAM.
Undo low A revert restores the previous messages without data changes.
Evidence low Real compiler comparisons and native valid-unit controls passed.
Sensitivity low No credentials, settings, saved data or release behavior touched.
Novelty low Uses existing parser and diagnostic mechanisms.
Dependencies low No dependency changes.

Pipeline

Updates from git push no-mistakes

Infinitary checked this version: an independent review that also judged the documents, and live validation the review accepted.

@github-actions github-actions Bot added this to the 0.1.1 milestone Nov 14, 2026
@mremond
mremond merged commit 3f9fcf1 into main Nov 15, 2026
21 checks passed
@mremond
mremond deleted the fm/task-90af6d72 branch November 15, 2026 14:05
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