Skip to content

Pin variables used in match (for elixir 1.20)#143

Open
geekingfrog wants to merge 1 commit into
dominicletz:masterfrom
geekingfrog:master
Open

Pin variables used in match (for elixir 1.20)#143
geekingfrog wants to merge 1 commit into
dominicletz:masterfrom
geekingfrog:master

Conversation

@geekingfrog

Copy link
Copy Markdown

Elixir 1.20 is getting stricter regarding matching when a variable is used.
This changes remove a bunch of warnings of the form:

the variable "len" is accessed inside size(...) of a bitstring but it was defined
outside of the match. You must precede it with the pin operator

See https://github.com/elixir-lang/elixir/blob/v1.20/CHANGELOG.md#elixir-12 for the changelog

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates lib/websockex/frame.ex to use the pin operator (^) when matching binary sizes with the size and len variables. This ensures correct pattern matching behavior and compatibility with newer Elixir versions. There are no review comments, so I have no feedback to provide.

Elixir 1.20 is getting stricter regarding matching when a variable is
used.
This changes remove a bunch of warnings of the form:
```
the variable "len" is accessed inside size(...) of a bitstring but it was defined outside of the match. You must precede it with the pin operator
```

See https://github.com/elixir-lang/elixir/blob/v1.20/CHANGELOG.md#elixir-12
for the changelog
@geekingfrog

Copy link
Copy Markdown
Author

Note, it's the same as #142 but also fix the warnings in the test files.

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