anchor.diff:                 '<enc>'('<F>', <<'<Bin>'/binary, '<Key>'>>),
                  Transforms)
       end;
  -field_encode_expr(MsgName, MsgVar, #gpb_oneof{name=FName, fields=OFields}, FVar,
  -                  PrevBVar, AnRes, Opts) ->
  +field_encode_expr(MsgName, MsgVar, #gpb_oneof{name=FName, fields=OFields},
  +                  FVar, PrevBVar, AnRes, Opts) ->
       OFVar = prefix_var("O", FVar),
  -    OneofClauseTransform =
  -        repeat_clauses(
  -          '<oneof...>',
  -          [begin
  -               MatchPattern =
  -                   case get_mapping_and_unset_by_opts(Opts) of
  -                       X when X == records;
  -                              X == {maps, present_undefined} ->
  -                           ?expr({'<oneof-name>', '<OF>'},
  -                                 [replace_term('<oneof-name>', Name),
  -                                  replace_tree('<OF>', OFVar)]);
  -                       {maps, omitted} ->
  -                           ?expr({ok, {'<oneof-name>', '<OF>'}},
  -                                 [replace_term('<oneof-name>', Name),
  -                                  replace_tree('<OF>', OFVar)])
  -                   end,
  -               %% undefined is already handled, we have a match,
  -               %% the field occurs, as if it had been required
  -               OField2 = OField#?gpb_field{occurrence=required},
  -               EncExpr = field_encode_expr(MsgName, MsgVar, OField2, OFVar,
  -                                           PrevBVar, AnRes, Opts),
  -               [replace_tree('<oneof...>', MatchPattern),
  -                replace_tree('<expr>', EncExpr)]
  +    OneofClauseTransforms =
  +        [begin
  +             OFVal = ?expr({'<oneof-name>', '<OF>'},
  +                           [replace_term('<oneof-name>', Name),
  +                            replace_tree('<OF>', OFVar)]),
  +             MatchPattern =
  +                 case get_mapping_and_unset_by_opts(Opts) of
  +                     X when X == records;
  +                            X == {maps, present_undefined} ->
  +                         OFVal;
  +                     {maps, omitted} ->
  +                         map_match([{FName, OFVal}])
  +                 end,
  +             %% undefined is already handled, we have a match,
  +             %% the field occurs, as if it had been required
  +             OField2 = OField#?gpb_field{occurrence=required},
  +             EncExpr = field_encode_expr(MsgName, MsgVar, OField2, OFVar,
  +                                         PrevBVar, AnRes, Opts),
  +             [replace_tree('<oneof...>', MatchPattern),
  +              replace_tree('<expr>', EncExpr)]
              end
  -           || #?gpb_field{name=Name}=OField <- OFields]),
  +           || #?gpb_field{name=Name}=OField <- OFields],
       case get_mapping_and_unset_by_opts(Opts) of
           X when X == records;
                  X == {maps, present_undefined} ->
  
positive.code:                           end,
                            Replacements);
                  {maps, omitted} ->
                      ?expr(case maps:find('<FName>', 'M') of
                                error ->
                                    ok;
                                {ok, '<F>'} ->
                                    '<verify-fn>'('<F>', ['<FName>' | Path])
                            end,
                            [replace_tree('M', MsgVar) | Replacements])
              end
      end;
  field_verifier(#gpb_oneof{name=FName, fields=OFields}, FVar, MsgVar, Opts) ->
  
negative.code:      replace_tree('NF', NF),
       replace_tree('Var', Var),
       replace_tree('Var#{fname=>NF}', map_set(Var, [{FName, NF}])),
       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'):
  