anchor.diff:  %% `false'. If you set it to `true', you may get into troubles for
   %% messages referencing other messages, when compiling the generated
   %% files.
  -file(File, Opts) ->
  -    case parse_file(File, Opts) of
  -        {ok, Defs} ->
  -            possibly_probe_defs(Defs, Opts),
  +file(File, Opts0) ->
  +    case parse_file(File, Opts0) of
  +        {ok, Defs0} ->
  +            {IsAcyclic, Defs} = try_topsort_defs(Defs0),
  +            possibly_probe_defs(Defs, Opts0),
  +            Opts1 = possibly_adjust_typespec_opt(IsAcyclic, Opts0),
               Ext = filename:extension(File),
               Mod = list_to_atom(filename:basename(File, Ext)),
               Erl = change_ext(File, ".erl"),
               Hrl = change_ext(File, ".hrl"),
  -            file_write_file(Erl, format_erl(Mod, Defs, Opts), Opts),
  -            file_write_file(Hrl, format_hrl(Mod, Defs, Opts), Opts);
  +            file_write_file(Erl, format_erl(Mod, Defs, Opts1), Opts1),
  +            file_write_file(Hrl, format_hrl(Mod, Defs, Opts1), Opts1);
           {error, _Reason} = Error ->
               Error
       end.
  
positive.code:                                  '$no'   -> "";
                                   Default -> f(" = ~p", [Default])
                               end,
                  TypeStr = f("~s", [type_to_typestr(Field)]),
                  CommaSep = if I < length(Fields) -> ",";
                                true               -> "" %% last entry
                             end,
  
negative.code:       [f("-ifndef(~p).~n", [Mod]),
         f("-define(~p, true).~n", [Mod]),
         "\n",
         string:join([format_msg_record(Msg, Fields, Opts, Defs)
                      || {{msg,Msg},Fields} <- Defs],
                     "\n"),
         "\n",
         f("-endif.~n")]).
  
  format_msg_record(Msg, Fields, Opts, Defs) ->
      [f("-record(~p,~n", [Msg]),
       f("        {"),
       outdent_first(format_hfields(8+1, Fields, Opts, Defs)),
       "\n",
       f("        }).~n")].
  
  format_hfields(Indent, Fields, CompileOpts, Defs) ->
      TypeSpecs = get_type_specs_by_opts(CompileOpts),
      string:join(
        lists:map(
          fun({I, #field{name=Name, fnum=FNum, opts=FOpts}=Field}) ->
  