Set error msg position to last occurrence of duplicate definition

This commit is contained in:
Ulf Norell 2019-09-03 10:18:22 +02:00
parent e37ac44726
commit db7bf7a730

View File

@ -2195,7 +2195,7 @@ mk_error({reserved_entrypoint, Name, Def}) ->
mk_error({duplicate_definition, Name, Locs}) -> mk_error({duplicate_definition, Name, Locs}) ->
Msg = io_lib:format("Duplicate definitions of ~s at\n~s", Msg = io_lib:format("Duplicate definitions of ~s at\n~s",
[Name, [ [" - ", pp_loc(L), "\n"] || L <- Locs ]]), [Name, [ [" - ", pp_loc(L), "\n"] || L <- Locs ]]),
mk_t_err(pos(hd(Locs)), Msg); mk_t_err(pos(lists:last(Locs)), Msg);
mk_error({duplicate_scope, Kind, Name, OtherKind, L}) -> mk_error({duplicate_scope, Kind, Name, OtherKind, L}) ->
Msg = io_lib:format("The ~p ~s (at ~s) has the same name as a ~p at ~s\n", Msg = io_lib:format("The ~p ~s (at ~s) has the same name as a ~p at ~s\n",
[Kind, pp(Name), pp_loc(Name), OtherKind, pp_loc(L)]), [Kind, pp(Name), pp_loc(Name), OtherKind, pp_loc(L)]),