diff --git a/rebar.config b/rebar.config index 38b6088..15ffea3 100644 --- a/rebar.config +++ b/rebar.config @@ -28,6 +28,7 @@ {dialyzer, [ {warnings, [ no_return , unmatched_returns , error_handling + , underspecs ]} , {plt_apps, top_level_deps} , {plt_extra_apps, [tools, syntax_tools]} diff --git a/src/ktn_code.erl b/src/ktn_code.erl index 09b1de2..b95aaea 100644 --- a/src/ktn_code.erl +++ b/src/ktn_code.erl @@ -250,7 +250,7 @@ to_str(Arg) when is_list(Arg) -> %%% Internal %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec source_encoding(binary() | list()) -> latin1 | utf8. +-spec source_encoding(binary()) -> latin1 | utf8. source_encoding(Source) -> Re = ".*\n?.*(coding *[:=] *(?[-a-zA-Z0-9]+))", ReOpts = [firstline, {capture, all_names, list}], @@ -836,7 +836,7 @@ to_map(Parsed) when is_tuple(Parsed) -> to_map(Parsed) -> throw({unexpected_abstract_form, Parsed}). --spec macro_name(any()) -> string(). +-spec macro_name(erl_syntax:syntaxTree()) -> string(). macro_name(Name) -> case erl_syntax:type(Name) of atom -> @@ -855,7 +855,7 @@ macro_name(Name) -> %% NOTE: Copied from ktn_lists not to bring the whole erlang-katana %% repo as a dependency here %% @end --spec split_when(fun(), list()) -> list(). +-spec split_when(fun((T) -> boolean()), [T]) -> [[T]]. split_when(When, List) -> split_when(When, List, [[]]). diff --git a/src/ktn_io_string.erl b/src/ktn_io_string.erl index 7689301..be1a2f9 100644 --- a/src/ktn_io_string.erl +++ b/src/ktn_io_string.erl @@ -112,7 +112,7 @@ do_get_line("\r" ++ RestStr, Result) -> do_get_line([Ch | RestStr], Result) -> do_get_line(RestStr, [Result, Ch]). --spec get_until(module(), atom(), list(), term()) -> +-spec get_until(module(), atom(), list(), eof | string()) -> {term(), string()}. get_until(Module, Function, XArgs, Str) -> apply_get_until(Module, Function, [], Str, XArgs).