From d932ad582676f1593d917f222b1d8dec71fe88b3 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Sun, 10 Jun 2012 13:01:50 +0200 Subject: Fix messages ordering with column numbers With L1, L2, C1, C2 integers such as L1 < L2 and C1 < C2, locations are ordered like this: L1 < {L1, C1} < {L1, C2} < L2 --- lib/compiler/src/compile.erl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'lib/compiler/src/compile.erl') diff --git a/lib/compiler/src/compile.erl b/lib/compiler/src/compile.erl index 8062ca59fa..d4d84e02fb 100644 --- a/lib/compiler/src/compile.erl +++ b/lib/compiler/src/compile.erl @@ -359,7 +359,17 @@ messages_per_file(Ms) -> (_) -> false end, A) end, T, PrioMs), - Prio = lists:sort(fun({_,{L1,_,_}}, {_,{L2,_,_}}) -> L1 =< L2 end, + Prio = lists:sort(fun({_,{As1,_,_}}, {_,{As2,_,_}}) -> + {location, Loc1} = + erl_scan:attributes_info(As1, location), + {location, Loc2} = + erl_scan:attributes_info(As2, location), + case {Loc1, Loc2} of + {{L1, _}, L2} when is_integer(L2) -> L1 < L2; + {L1, {L2, _}} when is_integer(L1) -> L1 =< L2; + {_, _} -> Loc1 =< Loc2 + end + end, lists:append(Prio0)), flatmap(fun mpf/1, [Prio, Rest]). -- cgit v1.2.3