Fix elixir dialyzer warnings

This commit is contained in:
James Fish
2014-09-03 19:29:01 +01:00
parent 5fd4abb857
commit 27ec4a9770
16 changed files with 53 additions and 34 deletions
+5 -5
View File
@@ -6,12 +6,12 @@
handle_file_warning/2, handle_file_warning/3, handle_file_error/2]).
-include("elixir.hrl").
-spec warn(non_neg_integer(), binary(), iolist()) -> ok.
-spec warn(non_neg_integer(), binary(), unicode:chardata()) -> ok.
warn(Line, File, Warning) when is_integer(Line), is_binary(File) ->
warn(file_format(Line, File), Warning).
-spec warn(iolist(), iolist()) -> ok.
-spec warn(unicode:chardata(), unicode:chardata()) -> ok.
warn(Caller, Warning) ->
do_warn([Caller, "warning: ", Warning, $\n]).
@@ -31,8 +31,8 @@ form_warn(Meta, File, Module, Desc) when is_list(Meta) ->
%% Compilation error.
-spec compile_error(list(), binary(), iolist()) -> no_return().
-spec compile_error(list(), binary(), iolist(), list()) -> no_return().
-spec compile_error(list(), binary(), unicode:charlist()) -> no_return().
-spec compile_error(list(), binary(), string(), list()) -> no_return().
compile_error(Meta, File, Message) when is_list(Message) ->
raise(Meta, File, 'Elixir.CompileError', elixir_utils:characters_to_binary(Message)).
@@ -241,4 +241,4 @@ do_raise(Line, File, Kind, Message) when is_integer(Line), is_binary(File), is_b
end,
Stacktrace = erlang:get_stacktrace(),
Exception = Kind:exception([{description, Message}, {file, File}, {line, Line}]),
erlang:raise(error, Exception, tl(Stacktrace)).
erlang:raise(error, Exception, tl(Stacktrace)).