anchor.diff:              throw({dialyzer_error, Error})
       end.
   
  -read_plt(State) ->
  -    Plt = rebar_state:get(State, dialyzer_plt),
  +read_plt(_State, Plt) ->
       case dialyzer:plt_info(Plt) of
           {ok, Info} ->
               Files = proplists:get_value(files, Info, []),
  
positive.code: 
  %% Internal functions
  
  set_plt_location(State) ->
      BuildDir = rebar_state:get(State, base_dir, ?DEFAULT_BASE_DIR),
      DefaultPlt = filename:join([BuildDir, ".rebar.plt"]),
      Plt = rebar_state:get(State, dialyzer_plt, DefaultPlt),
      rebar_state:set(State, dialyzer_plt, Plt).
  
  update_plt(State, Apps, Deps) ->
      {Args, _} = rebar_state:command_parsed_args(State),
      case proplists:get_value(update_plt, Args) of
          false ->
              {ok, State};
          _ ->
              do_update_plt(State, Apps, Deps)
      end.
  
  do_update_plt(State, Apps, Deps) ->
      ?INFO("Updating plt...", []),
      Files = get_plt_files(State, Apps, Deps),
      case read_plt(State) of
          {ok, OldFiles} ->
              check_plt(State, OldFiles, Files);
          {error, no_such_file} ->
              build_plt(State, Files)
      end.
  
  get_plt_files(State, Apps, Deps) ->
      case rebar_state:get(State, dialyzer_plt_apps) of
          undefined ->
              default_plt_files(Apps, Deps);
          PltApps ->
              app_names_to_files(PltApps, Apps ++ Deps)
      end.
  
  default_plt_files(Apps, Deps) ->
      DepApps = lists:flatmap(fun rebar_app_info:applications/1, Apps),
      default_plt_files(default_plt_apps() ++ DepApps, Apps, Deps, [], []).
  
  default_plt_apps() ->
      [erts,
       kernel,
       stdlib].
  
  default_plt_files([], _, _, _, Files) ->
      Files;
  default_plt_files([AppName | DepApps], Apps, Deps, PltApps, Files) ->
      case lists:member(AppName, PltApps) of
          true ->
              default_plt_files(DepApps, Apps, Deps, PltApps, Files);
          false ->
              {DepApps2, Files2} = app_name_to_info(AppName, Apps, Deps),
              DepApps3 = DepApps2 ++ DepApps,
              Files3 = Files2 ++ Files,
              default_plt_files(DepApps3, Apps, Deps, [AppName | PltApps], Files3)
      end.
  
  app_name_to_info(AppName, Apps, Deps) ->
      case rebar_app_utils:find(ec_cnv:to_binary(AppName), Apps) of
          {ok, App} ->
              % Don't include project app files in plt
              {rebar_app_info:applications(App), []};
          error ->
              app_name_to_info(AppName, Deps)
      end.
  
  apps_to_files(Apps) ->
      lists:flatmap(fun app_to_files/1, Apps).
  
  app_to_files(App) ->
      AppDetails = rebar_app_info:app_details(App),
      Modules = proplists:get_value(modules, AppDetails, []),
      EbinDir = rebar_app_info:ebin_dir(App),
      modules_to_files(Modules, EbinDir).
  
  modules_to_files(Modules, EbinDir) ->
      Ext = code:objfile_extension(),
  
negative.code: -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}.
  do(State) ->
      ?INFO("Dialyzer starting, this may take a while...", []),
      Plt = get_plt_location(State),
      Apps = rebar_state:project_apps(State),
  
      try
          {ok, State1} = update_proj_plt(State, Plt, Apps),
          succ_typings(State1, Plt, Apps)
      catch
          throw:{dialyzer_error, Error} ->
              {error, {?MODULE, {error_processing_apps, Error, Apps}}}
  