anchor.diff:        mk_fn(merge_msg_, MsgName),
         fun(_Prev, New) -> New end);
   format_msg_merger(MsgName, MsgDef, AnRes, Opts) ->
  -    MsgUndefFnClauses = compute_msg_merger_undef_clauses(MsgName, AnRes, Opts),
       {PrevMatch, NewMatch, ExtraInfo} =
           format_msg_merger_fnclause_match(MsgName, MsgDef, Opts),
       {MandatoryMergings, OptMergings} = compute_msg_field_mergers(
                                            ExtraInfo, MsgName, AnRes),
       gpb_codegen:format_fn(
         mk_fn(merge_msg_, MsgName),
  -      fun('<msg-undefined-handling>', _) -> '<return-the-defined-msg>';
  -         ('Prev', 'New')                 -> '<merge-it>'
  +      fun('Prev', 'New')                 -> '<merge-it>'
         end,
         [replace_tree('Prev',  PrevMatch),
          replace_tree('New',   NewMatch),
  
positive.code:      replace_tree('Var#{fname=>PF}', map_set(Var, [{FName, PF}])),
       replace_tree('#{fname := NF}', map_match([{FName, NF}])),
       replace_tree('#{fname := PF}', map_match([{FName, PF}]))].
  
  occurs_as_optional_submsg(MsgName, #anres{msg_occurrences=Occurrences}=AnRes) ->
      %% Note: order of evaluation below is important (the exprs of `andalso'):
      %% Messages are present in Occurrences only if they are sub-messages
      can_occur_as_sub_msg(MsgName, AnRes) andalso
          case dict:find(MsgName, Occurrences) of
              error       -> false; % likely only referenced from a oneof
              {ok, MOccs} -> lists:member(optional, MOccs)
          end.
  
  format_field_skippers(MsgName, AnRes) ->
      SkipVarintFnName = mk_fn(skip_varint_, MsgName),
  
negative.code: render_field_merger({expr, Expr}) ->
      Expr;
  render_field_merger({merge, {{PF, NF}, Tr, MergeFn}}) ->
      ?expr(if 'PF' /= undefined, 'NF' /= undefined -> 'merge'('PF', 'NF');
               'PF' == undefined -> 'NF';
               'NF' == undefined -> 'PF'
            end,
            [replace_tree('PF', PF),
             replace_tree('NF', NF),
             replace_term('merge', Tr(merge, MergeFn))]);
  