fixes to dialyzer

All types should now be correct and dialyzer runs successfully

Signed-off-by: Jordan Wilberding <diginux@gmail.com>
This commit is contained in:
Eric Merritt 2012-09-04 20:27:19 -05:00
parent 7e42c243b0
commit e035ae3dbf
12 changed files with 107 additions and 92 deletions

View file

@ -20,11 +20,13 @@
%%%===================================================================
-type semvar() :: string().
-type parsed_semvar() :: {MajorVsn::string(),
MinorVsn::string(),
PatchVsn::string(),
-type parsed_semvar() :: {MajorVsn::integer(),
MinorVsn::integer(),
PatchVsn::integer(),
PathString::string()}.
-type semver_tokens() :: {string(), string(), string(), string()}.
%%%===================================================================
%%% API
%%%===================================================================
@ -41,7 +43,7 @@ compare(VsnA, VsnB) ->
%%% Internal Functions
%%%===================================================================
-spec tokens(semvar()) -> parsed_semvar().
-spec tokens(semvar()) -> semver_tokens().
tokens(Vsn) ->
[MajorVsn, MinorVsn, RawPatch] = string:tokens(Vsn, "."),
{PatchVsn, PatchString} = split_patch(RawPatch),
@ -62,7 +64,7 @@ split_patch([Dig|T], {PatchVsn, PatchStr}) when Dig >= $0 andalso Dig =< $9 ->
split_patch(PatchStr, {PatchVsn, ""}) ->
{PatchVsn, PatchStr}.
-spec compare_toks(parsed_semvar(), parsed_semvar()) -> boolean().
-spec compare_toks(semver_tokens(), semver_tokens()) -> boolean().
compare_toks({MajA, MinA, PVA, PSA}, {MajB, MinB, PVB, PSB}) ->
compare_toks2({to_int(MajA), to_int(MinA), to_int(PVA), PSA},
{to_int(MajB), to_int(MinB), to_int(PVB), PSB}).