Skip to content

Specialize generated code to eliminate downstream Dialyzer warnings - #18

Merged
jallum merged 1 commit into
mainfrom
fix/fb-3lk-codegen
Sep 3, 2026
Merged

Specialize generated code to eliminate downstream Dialyzer warnings#18
jallum merged 1 commit into
mainfrom
fix/fb-3lk-codegen

Conversation

@jallum

@jallum jallum commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • generate reader and writer clauses only for schema types reachable from the root
  • precompute vector sizes and alignments instead of emitting runtime dispatchers
  • preserve unsupported union-vector errors without generating unreachable member code
  • add a downstream macro-consumer Dialyzer project to CI, with normal, safe, minimal, sparse, and union-vector-only schemas
  • use no Dialyzer attributes, ignore files, or generated-code warning suppression

Evidence

The downstream fixture reproduced 21 Dialyzer errors and 10 skipped/unlexable warnings before the change. It now reports 0 errors, 0 skipped warnings, and 0 unnecessary skips with a forced PLT check.

  • Elixir 1.18 / OTP 27: 142 tests, 0 failures
  • Elixir 1.19 / OTP 28: 140 tests, 0 failures
  • Elixir 1.20 / OTP 29: 140 tests, 0 failures
  • flatc integration: 2 tests, 0 failures
  • mix format --check-formatted
  • mix deps.unlock --check-unused

Benchee on Elixir 1.19 / OTP 28 measured the generated decoder at 362K ips versus 143K interpreted, and the generated encoder at 94K ips versus 83K interpreted. Generated decoding retained its 19.77 KB allocation profile.

Tracks fb-3lk.

@jallum
jallum merged commit 1e2d359 into main Sep 3, 2026
4 checks passed
jallum pushed a commit that referenced this pull request Sep 3, 2026
…ated reader/writer code to root-reachable schema types, precomputes vector layout, preserves union-vector error behavior, and adds a suppression-free downstream Dialyzer integration check. All PR CI jobs are green."
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