Open OvermindDL1 opened 5 years ago
That's actually showing a bug in Gradualixir (I think?). Pretty much everywhere I'm listing a String.t()
in the typespecs as the input type for pretty_print_X
should be a charlist()
but it's not telling us that. Looking at my typespecs more closely, they have some really deep issues I need to address, but the type checks on your end are not telling us about them.
It's still heavily in dev, though thus far what it detects has seemed pretty accurate, it just tends to crash or give excess errors about what it doesn't (like maps barely have support so far). I think it lets the typespec mostly override a function similar to dialyzer but I'm unsure yet, barely playing with it so far. However this library is small yet still complicated enough that it makes a great test bed for my experiments. :-)
Just an FYI @OvermindDL1 that this project now lives here, feel free to re-open this issue over there if it's still a thing.
Nothing big, just noticing a potential couple bugs as I was running a new BEAM typer (it's a negative ML typer, not a weak positive typer like Dialyzer, Gradualizer, would make for an awesome addition into Dialyxir so I don't have to publish and keep up Gradualixir ^.^) over one of my projects and erlex had a couple things pop up that aren't entirely, though some are it's fault:
And the
lexer.erl
file is fine.In essence it's saying that:
The
lib/erlex.ex
file line 269 thebyte
in the expression of<<byte::8>>
is supposed to have type integer, but it can potentially be any type, and thus can potentially fail, however that's because Elixir'sEnum.into/3
isn't typespec'd properly, so that's entirely Elixir's fault.The
lib/erlex.ex
file on (not actually line 0) https://github.com/asummers/erlex/blob/master/lib/erlex.ex#L73 it has the linedef pretty_print_infix('=:='), do: "==="
but it's typespec'd as@spec pretty_print_infix(infix :: String.t()) :: String.t()
and Elixir'sString.t()
type is typespec'd as https://github.com/elixir-lang/elixir/blob/v1.9.2/lib/elixir/lib/string.ex#L213 :And thus the character list is not a binary, hence it's failing (isn't dialyzer itself catching this one?!).
Same thing again on line https://github.com/asummers/erlex/blob/master/lib/erlex.ex#L96 with
def pretty_print_pattern('pattern ' ++ rest) do
when it's typespec'd as@spec pretty_print_pattern(pattern :: String.t()) :: String.t()
binaries.As for the parser file, no clue where it is complaining about, but it's missing a failure case and the success case is too tightly bound.
This was mostly just for fun, and the fact erlex only has 4 issues reported unlike the 4000 that most other libraries have. ^.^;