Fix Elixir v1.19 warnings #13
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes warnings that appear when running on Elixir 1.17+ and 1.19+, addressing both deprecated syntax and new type system checks.
Issues Fixed
1. Elixir 1.17+ Charlist Deprecation Warnings
In Elixir v1.17, single-quoted charlists were hard deprecated. The warning states:
Changes:
test/xpeg_test.exsandtest/examples_test.exsto use~csigil'a'→~c"a"and{'a'..'z'}→{~c"a"..~c"z"}2. Elixir 1.19 Type System Warnings (Arity Mismatch)
Elixir v1.19 introduced enhanced type inference for anonymous functions, which detected an arity mismatch in the code generator:
Root Cause:
The code was conditionally calling functions with different arities at runtime based on the
userdataoption, but generating the same call site.Solution:
Split code generation into separate branches at compile-time (commit bab109d). Now the compiler generates the correct function call for each case:
userdata: true→ generatesfunc.(captures, ctx)(2-arity)userdata→ generatesfunc.(captures)(1-arity)This eliminates the runtime conditional and allows the type system to correctly verify each path.
Testing