Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matches when pattern matching on binaries return false consistency report #45

Closed
gausby opened this issue Feb 25, 2016 · 7 comments
Closed
Assignees

Comments

@gausby
Copy link

gausby commented Feb 25, 2016

A situation like:

@spec foo(binary, list(integer)) :: binary | no_return
def foo(data, length_acc) do
  len = length_acc |> Enum.sum
  <<data::size(len)-binary, _::binary>>
end

Would result in There are spaces around operators most of the time, but not here. on the <<data::size(len)-binary, _::binary>>-line

@rrrene rrrene self-assigned this Feb 26, 2016
@rrrene
Copy link
Owner

rrrene commented Feb 26, 2016

👍 Thx for reporting!

@rrrene rrrene closed this as completed in 0eadd64 Feb 29, 2016
@rrrene
Copy link
Owner

rrrene commented Feb 29, 2016

Fix included in v0.3.4! Can you confirm this works as expected?

@gausby
Copy link
Author

gausby commented Mar 2, 2016

@rrrene it works! 👍

@dantswain
Copy link

Hi @rrrene I'm actually still getting this in 0.3.11. Two different cases:

┃       There are spaces around operators most of the time, but not here.
┃       lib/kafka_ex/compression.ex:55:47 (KafkaEx.Compression.snappy_decompress_chunk)
┃
┃    __ CODE IN QUESTION
┃
┃       def snappy_decompress_chunk(<< valsize :: 32-unsigned,
┃                                                   ^

and

┃       There are spaces around operators most of the time, but not here.
┃       lib/kafka_ex/compression.ex:56:53 (KafkaEx.Compression.snappy_decompress_chunk)
┃
┃    __ CODE IN QUESTION
┃
┃       value :: size(valsize)-binary,
┃                             ^

@rrrene
Copy link
Owner

rrrene commented Apr 11, 2016

@dantswain thanks for the report. will provide a fix. 👍

@rrrene
Copy link
Owner

rrrene commented Apr 12, 2016

@dantswain I released a fix in v0.3.12 :shipit:

P.S. You should be awarded some internet points for re-opening an existing, relevant issue instead of creating a new one. Well done! 🌟 👍 🌟

@dantswain
Copy link

Confirmed it fixed the issues I was seeing. Thanks! 👍

dantswain added a commit to dantswain/thrash that referenced this issue Apr 15, 2016
The only credo warnings are, I believe, bugs in credo.  See rrrene/credo#45
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

No branches or pull requests

3 participants