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

Fix Dialyzer errors #5

Merged
merged 1 commit into from
Jul 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions lib/expand.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ defmodule Expostal.Expand do
"781 franklin avenue crown heights brooklyn ny"]

"""
@spec expand_address(address :: String.t) :: list(String.t)
def expand_address(address)
def expand_address(_) do
exit(:nif_library_not_loaded)
@spec expand_address(address :: String.t) :: [String.t]
def expand_address(address) do
case :erlang.phash2(1, 1) do
0 -> raise "Nif not loaded"
1 -> [address]
end
end

end
7 changes: 5 additions & 2 deletions lib/parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ defmodule Expostal.Parser do
road: "rene levesque ouest", state: "qc"}

"""
@spec parse_address(address :: String.t) :: String.t
@spec parse_address(address :: String.t) :: map
def parse_address(address)
def parse_address(_) do
exit(:nif_library_not_loaded)
case :erlang.phash2(1, 1) do
0 -> raise "Nif not loaded"
1 -> %{}
end
end

end
5 changes: 4 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ defmodule Expostal.Mixfile do
#
# Type "mix help deps" for more examples and options
defp deps do
[{:ex_doc, "~> 0.14", only: :dev, runtime: false}]
[
{:ex_doc, "~> 0.14", only: :dev, runtime: false},
{:dialyxir, "~> 0.5", only: :dev, runtime: false}
]
end

defp description do
Expand Down
3 changes: 2 additions & 1 deletion mix.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
%{"earmark": {:hex, :earmark, "1.2.2", "f718159d6b65068e8daeef709ccddae5f7fdc770707d82e7d126f584cd925b74", [:mix], [], "hexpm"},
%{"dialyxir": {:hex, :dialyxir, "0.5.0", "5bc543f9c28ecd51b99cc1a685a3c2a1a93216990347f259406a910cf048d1d7", [:mix], [], "hexpm"},
"earmark": {:hex, :earmark, "1.2.2", "f718159d6b65068e8daeef709ccddae5f7fdc770707d82e7d126f584cd925b74", [:mix], [], "hexpm"},
"ex_doc": {:hex, :ex_doc, "0.16.1", "b4b8a23602b4ce0e9a5a960a81260d1f7b29635b9652c67e95b0c2f7ccee5e81", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}], "hexpm"},
"libpostal": {:git, "https://github.com/openvenues/libpostal.git", "8dd84b71bad4c70150e60c7bda8071b9bd8902f8", []}}