rrrene / credo

A static code analysis tool for the Elixir language with a focus on code consistency and teaching.
http://credo-ci.org/
MIT License
4.94k stars 419 forks source link

Invalid warnings on typespecs with bitstrings #1079

Closed lukaszsamson closed 11 months ago

lukaszsamson commented 1 year ago

Precheck

Environment

Elixir 1.15.6 (compiled with Erlang/OTP 26)

What were you trying to do?

Function with valid spec (nonempty bitstring and bitstring)

@spec some() :: <<_::1, _::_*1>>
def some(), do: <<1::1>>
@spec other() :: <<_::_*1>>
def other(), do: <<>>

Expected outcome

No warning

Actual outcome

Warning

Operation will always return the left side of the expression.
rrrene commented 11 months ago

Thx for reporting! 👍

rrrene commented 11 months ago

Thanks for reporting this 😀 It is now fixed on master.

You can try this by setting the Credo dep to

{:credo, github: "rrrene/credo"}

Please report back if your issue is solved! 👍

rrrene commented 11 months ago

This is part of Credo 1.7.2. :+1: