From db7bf7a730ad39772d3f794c01679f6065cbcac2 Mon Sep 17 00:00:00 2001 From: Ulf Norell Date: Tue, 3 Sep 2019 10:18:22 +0200 Subject: [PATCH] Set error msg position to last occurrence of duplicate definition --- src/aeso_ast_infer_types.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aeso_ast_infer_types.erl b/src/aeso_ast_infer_types.erl index c064a59..11ecae1 100644 --- a/src/aeso_ast_infer_types.erl +++ b/src/aeso_ast_infer_types.erl @@ -2195,7 +2195,7 @@ mk_error({reserved_entrypoint, Name, Def}) -> mk_error({duplicate_definition, Name, Locs}) -> Msg = io_lib:format("Duplicate definitions of ~s at\n~s", [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}) -> 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)]),