anchor.diff:                       true  -> MiscAtoms0 ++ [true, false];
                        false -> MiscAtoms0
                    end,
  -    Atoms = lists:usort(EnumAtoms ++ RecordAtoms ++ OneofNames ++ MiscAtoms1),
  +    FieldAtoms = if Maps ->
  +                         lists:usort(
  +                           lists:flatten(
  +                             [[get_field_name(Field) || Field <- Fields]
  +                              || {{msg,_MsgName}, Fields} <- Defs]));
  +                    not Maps ->
  +                         []
  +                 end,
  +    MiscAtoms2 = MiscAtoms1 ++ FieldAtoms,
  +    Atoms = lists:usort(EnumAtoms ++ RecordAtoms ++ OneofNames ++ MiscAtoms2),
       AtomVars = [{mk_c_var(gpb_aa_, A), A} || A <- Atoms],
   
       [[?f("static ERL_NIF_TERM ~s;\n", [Var]) || {Var,_Atom} <- AtomVars],
  
positive.code: get_field_occurrence(#?gpb_field{occurrence=Occurrence}) -> Occurrence;
  get_field_occurrence(#gpb_oneof{})                       -> optional.
  
  %% -> {Optionals, NonOptionals}
  key_partition_on_optionality(Key, Items) ->
      lists:partition(fun(Item) ->
  
negative.code:       || {{msg, MsgName}, _Fields} <- Defs],
       "\n"].
  
  format_nif_cc_mk_atoms(_Mod, Defs, AnRes, Opts) ->
      Maps = get_records_or_maps_by_opts(Opts) == maps,
      EnumAtoms = lists:flatten([[Sym || {Sym, _V} <- EnumDef]
                                 || {{enum, _}, EnumDef} <- Defs]),
      RecordAtoms = [MsgName || {{msg, MsgName}, _Fields} <- Defs],
  