Skip to content

fix(ir): compile unsupported float widths with OTP warnings - #54

Merged
mremond merged 3 commits into
mainfrom
fm/task-d101b079
Nov 15, 2026
Merged

mremond merged 3 commits into
mainfrom
fm/task-d101b079

Conversation

@mremond

@mremond mremond commented Nov 15, 2026

Copy link
Copy Markdown
Member

Why

Erlang modules should compile unsupported literal float widths while retaining OTP's warnings and runtime behavior.

What changed

  • Unsupported literal float widths produce warnings instead of rejecting the module.
  • Construction retains runtime errors, and impossible patterns still fail to match.
  • A dedicated warning code keeps editor suppression separate from binary-segment errors.

Before and after

Before: The new regression could not compile because Nera classified unsupported float widths as errors.

After: The same regression compiles with warnings and passes on native Nera and OTP.

This changes compiler diagnostics and retained runtime behavior, not a graphical view; command output and editor diagnostic responses provide evidence.

Checked

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

Scenario Result Evidence
Unsupported literal and scaled widths compile with warnings and retain runtime errors. ✅ Passed live Native and OTP output matched exactly for both badarg results and supported encoding; compiler transcripts retain OTP's warning wording.
Impossible float patterns preserve fallthrough, badmatch and empty-generator behavior. ✅ Passed live The shared native/OTP fixture completed head, fun, body-match, receive and comprehension assertions; both demonstrations returned fallback and an empty list.
Editor warning suppression leaves existing binary-segment errors visible. ✅ Passed live The actual editor server returned only the UTF size error after suppressing bad_float_bit_size.
  • Native suite: 505 passed; two external-module tests skipped.
  • Rust workspace: 2,202 checks passed.
  • Consecutive runs: 267 warning-analysis tests and the new native regression each passed ten consecutive runs without retries.
  • Other gates: Locked release build, strict clippy, allocator checks and stacktrace regression passed.
How it was checked

cargo build --release --locked -j 6

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

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

python3 scripts/test-allocator-config.py

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

python3 scripts/test-stacktrace-order.py

cargo test --locked -p nera-ir -j 6 warnings::tests:: -- --test-threads=1, repeated ten times

./target/release/nera test binary_float_unsupported_width -j 1 --timeout 30, repeated ten times

Compiled and ran the same regression on OTP 29.1.2.

Compared native and OTP demonstration output byte for byte and verified suppression through the editor diagnostic server.

Risk

Risk: low in every dimension.

Full risk assessment
Dimension Level Why
Blast radius low One compiler diagnostic rule and its regression coverage change.
Behavior low Corrects module rejection while retaining runtime and matching behavior.
Undo low Reverting the change restores the prior diagnostic behavior.
Evidence low Native execution, OTP comparison and actual editor diagnostics passed.
Sensitivity low No saved data, credentials, signing or release behavior changes.
Novelty low Uses the existing diagnostic predicate and runtime checks.
Dependencies low No dependencies change.
Not done

Two existing external-module native tests remain skipped.

Per-function warning suppression is verified in editor diagnostics; the existing command-line path does not apply those pragmas.

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 15, 2026
@mremond
mremond merged commit 53ca1ef into main Nov 15, 2026
22 checks passed
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