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

Resolve missing range error. #385

Merged
merged 3 commits into from
Mar 11, 2020
Merged
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/dialyxir/warnings/missing_range.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ defmodule Dialyxir.Warnings.MissingRange do

@impl Dialyxir.Warning
@spec format_short([String.t()]) :: String.t()
def format_short([_module, function | _]) do
"The type specification is missing types returned by #{function}."
def format_short([module, function, arity | _]) do
pretty_module = Erlex.pretty_print(module)

"The type specification is missing types returned by #{pretty_module}.#{function}/#{arity}."
end

@impl Dialyxir.Warning
@spec format_long([String.t()]) :: String.t()
def format_long([module, function, arity, extra_ranges, contract_range]) do
pretty_module = Erlex.pretty_print(module)
pretty_contract_range = Erlex.pretty_print_contract(contract_range)
pretty_contract_range = Erlex.pretty_print_args(contract_range)
pretty_extra_ranges = Erlex.pretty_print_contract(extra_ranges)

"""
Expand All @@ -27,7 +29,7 @@ defmodule Dialyxir.Warnings.MissingRange do
Type specification return types:
#{pretty_contract_range}

Extra types in success typing:
Missing types:
#{pretty_extra_ranges}
"""
end
Expand Down