Skip to content

Fix Elixir 1.20 warnings#431

Merged
whatyouhide merged 2 commits into
elixir-protobuf:mainfrom
nyo16:fix/elixir-1.20-warnings
Mar 11, 2026
Merged

Fix Elixir 1.20 warnings#431
whatyouhide merged 2 commits into
elixir-protobuf:mainfrom
nyo16:fix/elixir-1.20-warnings

Conversation

@nyo16

@nyo16 nyo16 commented Feb 17, 2026

Copy link
Copy Markdown
Contributor
  • Add pin operator (^) to variables used inside size(...) in bitstring patterns, as required by Elixir 1.20
  • Fixes 22 compilation warnings introduced by the new Elixir 1.20 requirement that variables defined outside a match must be pinned when used in size(...)
  • Changes in Protobuf.Decoder (3 locations) and Protobuf.JSON.RFC3339 (2 locations)

Test plan

  • mix compile --force --all-warnings produces 0 warnings
  • mix test — all 483 tests pass with no failures"2>&1

@whatyouhide

Copy link
Copy Markdown
Collaborator

@nyo16 this breaks compatibility with older versions. We can bump version req to 1.15 but we'll need to address those if they are problematic there as well. Could you take a look?

The ^ pin operator in binary size specifiers (e.g. bytes-size(^value))
was introduced in Elixir 1.16.0. Update the minimum version requirement
and CI matrix accordingly.
@nyo16

nyo16 commented Feb 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review! I dug into this — the ^ pin operator in binary size specifiers was introduced in Elixir 1.16.0 (verified against the compiler source), so bumping to 1.15 alone
wouldn't cover it.

That said, these are just warnings on Elixir 1.20, not errors — the code without ^ still compiles and works fine. So if maintaining broader compatibility is more important, it's totally
reasonable to leave things as-is for now. I can keep this on my fork for my own sanity (OCD) in the meantime.

If you do want to address them, I've updated the PR to:

  • Bump minimum Elixir to ~> 1.16 in mix.exs
  • Update CI matrix and conformance tests to match (1.16.3/OTP 26.0)

Happy to go either way — let me know what you prefer.

@whatyouhide
whatyouhide merged commit 17914c5 into elixir-protobuf:main Mar 11, 2026
5 checks passed
@whatyouhide

Copy link
Copy Markdown
Collaborator

Ok, let's bump the requirement. Thanks @nyo16 🫶

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.

2 participants