Skip to content

Commit

Permalink
Fixed interal consistency error on elixir 1.10.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jechol committed Sep 8, 2020
1 parent c0c86ff commit 9610b26
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The package can be installed by adding `base32h` to your list of dependencies in
```elixir
def deps do
[
{:base32h, "~> 0.3.0"}
{:base32h, "~> 0.3.1"}
]
end
```
Expand Down
6 changes: 3 additions & 3 deletions lib/base32h.ex
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ defmodule Base32H do
"WELLH0WDYPARDNER"
"""
@spec encode_bin(binary()) :: String.t()
def encode_bin(<<bin::binary>> = bin) do
def encode_bin(bin) when is_binary(bin) do
padded = add_padding(bin, 5, 0)

for <<chunk::binary-size(5) <- padded>> do
Expand All @@ -93,7 +93,7 @@ defmodule Base32H do
8_675_309
"""
@spec decode(String.t()) :: non_neg_integer()
def decode(<<str::binary>> = str) do
def decode(str) when is_binary(str) do
str
|> String.to_charlist()
|> Enum.reduce(0, fn c, acc -> acc * 32 + Map.fetch!(@decode_map, c) end)
Expand All @@ -106,7 +106,7 @@ defmodule Base32H do
<<0, 0, 0, 8, 6, 7, 5, 3, 0, 9>>
"""
@spec decode_bin(String.t()) :: binary()
def decode_bin(<<str::binary>> = str) do
def decode_bin(str) when is_binary(str) do
binary_size = (div(String.length(str) - 1, 8) + 1) * 5
<<decode(str)::size(binary_size)-unit(8)>>
end
Expand Down
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Base32H.MixProject do
def project do
[
app: :base32h,
version: "0.3.0",
version: "0.3.1",
elixir: "~> 1.8",
start_permanent: Mix.env() == :prod,
deps: deps(),
Expand All @@ -26,7 +26,7 @@ defmodule Base32H.MixProject do
defp deps do
[
{:ex_doc, "~> 0.22", only: :dev, runtime: false}
# {:dep_from_hexpm, "~> 0.3.0"},
# {:dep_from_hexpm, "~> 0.3.1"},
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
]
end
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ let
inherit (pkgs.lib) optional optionals;
in pkgs.mkShell {
buildInputs =
[ jechol-nur.beam.all.packages.erlang_22_0.elixirs.elixir_1_10_0 ];
[ jechol-nur.beam.all.packages.erlang_23_0.elixirs.elixir_1_10_4 ];
}

0 comments on commit 9610b26

Please sign in to comment.