Sort errors by position

This commit is contained in:
Ulf Norell 2019-09-09 12:22:40 +02:00
parent 9eeb9ab11d
commit 0f612ead90

View File

@ -59,7 +59,8 @@ pos(File, Line, Col) ->
-spec throw(_) -> ok | no_return().
throw([]) -> ok;
throw(Errs) when is_list(Errs) ->
erlang:throw({error, Errs});
SortedErrs = lists:sort(fun(E1, E2) -> E1#err.pos =< E2#err.pos end, Errs),
erlang:throw({error, SortedErrs});
throw(#err{} = Err) ->
erlang:throw({error, [Err]}).