anchor.diff:          smember({enum, EnumName}, UsedTypes)].
   
   format_enum_verifier(EnumName, EnumMembers) ->
  -    gpb_codegen:format_fn(
  -      mk_fn(v_enum_, EnumName),
  -      fun('<sym>', _Path) -> ok;
  -         (X, Path) -> mk_type_error({invalid_enum, '<EnumName>'}, X, Path)
  -      end,
  -      [repeat_clauses('<sym>', [[replace_term('<sym>', EnumSym)]
  -                                || {EnumSym, _Value} <- EnumMembers]),
  -       replace_term('<EnumName>', EnumName)]).
  +    FnName = mk_fn(v_enum_, EnumName),
  +    [nowarn_dialyzer_attr(FnName, 2),
  +     gpb_codegen:format_fn(
  +       FnName,
  +       fun('<sym>', _Path) -> ok;
  +          (X, Path) -> mk_type_error({invalid_enum, '<EnumName>'}, X, Path)
  +       end,
  +       [repeat_clauses('<sym>', [[replace_term('<sym>', EnumSym)]
  +                                 || {EnumSym, _Value} <- EnumMembers]),
  +        replace_term('<EnumName>', EnumName)])].
   
   format_type_verifiers(#anres{used_types=UsedTypes}) ->
       [[format_int_verifier(sint32, signed, 32)   || smember(sint32, UsedTypes)],
  
positive.code:                           records -> can_occur_as_sub_msg(MsgName, AnRes);
                            maps    -> true
                        end,
      gpb_codegen:format_fn(
        mk_fn(v_msg_, MsgName),
        fun('<msg-match>', '<Path>') ->
                '<verify-fields>',
                ok;
           ('<M>', Path) when is_map('<M>') ->
                mk_type_error(
                  {missing_fields, 'NonOptKeys' -- maps:keys('<M>'), '<MsgName>'},
                  '<M>', Path);
           ('<X>', Path) ->
                mk_type_error({expected_msg,'<MsgName>'}, X, Path)
        end,
        [replace_tree('<msg-match>', FieldMatching),
         replace_tree('<Path>', if MsgDef == [] -> ?expr(_Path);
                                   MsgDef /= [] -> ?expr(Path)
                                end),
         splice_trees('<verify-fields>',
                      field_verifiers(MsgDef, FVars, MsgVar, Opts)),
         repeat_clauses('<X>', case NeedsMatchOther of
                                   true  -> [[replace_tree('<X>', ?expr(X))]];
                                   false -> [] %% omit the else clause
                               end),
         repeat_clauses('<M>',
                        case get_records_or_maps_by_opts(Opts) of
                            records ->
                                []; % omit this clause
                            maps ->
                                [[replace_tree('<M>', ?expr(M)),
                                  replace_term('NonOptKeys', NonOptKeys)]]
                        end),
         replace_term('<MsgName>', MsgName)]).
  
  field_verifiers(Fields, FVars, MsgVar, Opts) ->
      [field_verifier(Field, FVar, MsgVar, Opts)
  
negative.code:                           {enum,EnumName} -> mk_fn(v_enum_, EnumName);
                            Type            -> mk_fn(v_type_, Type)
                        end,
      [nowarn_dialyzer_attr(FnName, 2),
       case RecordsOrMaps of
           records ->
               gpb_codegen:format_fn(
                 FnName,
                 fun(KVs, Path) when is_list(KVs) ->
                         [case X of
                              {Key, Value} ->
                                  'VerifyKey'(Key, ['key' | Path]),
                                  'VerifyValue'(Value, ['value' | Path]);
                              _ ->
                                  mk_type_error(invalid_key_value_tuple, X, Path)
                          end
                          || X <- KVs],
                         ok;
                    (X, Path) ->
                         mk_type_error(invalid_list_of_key_value_tuples, X, Path)
                 end,
                 [replace_term('VerifyKey', KeyVerifierFn),
                  replace_term('VerifyValue', ValueVerifierFn)]);
           maps ->
               gpb_codegen:format_fn(
                 FnName,
                 fun(M, Path) when is_map(M) ->
                         [begin
                              'VerifyKey'(Key, ['key' | Path]),
                              'VerifyValue'(Value, ['value' | Path])
                          end
                          || {Key, Value} <- maps:to_list(M)],
                         ok;
                    (X, Path) ->
                         mk_type_error(invalid_map, X, Path)
                 end,
                 [replace_term('VerifyKey', KeyVerifierFn),
                  replace_term('VerifyValue', ValueVerifierFn)])
       end].
  
  format_verifier_auxiliaries(Defs) ->
      ["-spec mk_type_error(_, _, list()) -> no_return().\n",
  