anchor.diff:        match load_checked_file_with_tc_result
                 (TcEnv.dep_graph env.env_tcenv)
                 fn
  -              cache_file |> fst with
  -      | Invalid msg -> fail msg cache_file; None
  -      | Valid (_, tc_result) ->
  +              cache_file with
  +      | Inl msg -> fail msg cache_file; None
  +      | Inr tc_result ->
           if Options.debug_any () then
           BU.print1 "Successfully loaded module from checked file %s\n" cache_file;
           Some tc_result
  
positive.code:     if not (BU.file_exists checked_fn)
      then let msg = BU.format1 "checked file %s does not exist" checked_fn in
           add_and_return (Invalid msg, Inl msg)
      else match BU.load_value_from_file checked_fn with
           | None ->
             let msg = BU.format1 "checked file %s is corrupt" checked_fn in
             add_and_return (Invalid msg, Inl msg)
           | Some (vnum, deps_dig, dig, parsing_data, tc_result) ->
             if vnum <> cache_version_number
             then let msg = BU.format1 "checked file %s has incorrect version" checked_fn in
                  add_and_return (Invalid msg, Inl msg)
  
negative.code:         in
          let elt = (Invalid msg, Inl msg) in
          BU.smap_add mcache checked_fn elt;
          Inl msg
        end
  
  
  let load_parsing_data_from_cache file_name =
    (*
     * the code below suppresses the already_cached assertion failure
     * following is the reason for it:
     *
     * consider a scenario:
     * A.fst -> B.fsti -> prims.fst
     *            ^      ^
     *            |     /
     *             B.fst
     *
     * the dependence analysis marks B.fsti as a dependence of A.fst
     * so when we use the makefiles to build this,
     *   makefile could first build prims, then B.fsti, and then tried to build A.fst
     *   with: fstar.exe A.fst already_cached '* -A'
     * now F* starts to build the dependence graph for A
     * it sees that A depends on B, so it reads the parsing data
     *   of B.fsti from its existing checked file
     * however, the dependence analysis ALSO reads B.fst so as to detect cycles
     * and calls load_parsing_data_from_cache_file with B.fst
     * clearly until this point, B.fst has not been checked and so its checked file doesn't exist
     * so cache_file_name raises an exception since B is in the already_cached list
     *
     * suppressing the exception here is not too bad since this exception is raised at other places
     *   e.g. when loading the checked file for typechecking purposes
     *
     * another way to handle this kind of thing would be to NOT load B.fst for cycle detection,
     *   rather provide a separate F* command --detect_cycles --alredy_cached '*' that builds
     *   can invoke in the end for cycle detection
     *)
    let cache_file =
      try
       Parser.Dep.cache_file_name file_name |> Some
      with _ -> None
  