Fix multifile ordering dependent decl behavior
Summary:
In the diff below this, I demonstrate the issue - "multifile single file" tests are subject to ordering differences in OCaml in our "rupro vs ocaml decl comparison" binary.
This diff corrects this behavior in our binary.
The ordering dependent behavior occurs here:
```
(* Compute OCaml folded decls *)
List.iter files ~f:(fun filename ->
Errors.run_in_context filename Errors.Decl (fun () ->
Decl.make_env ~sh:SharedMem.Uses ctx filename));
```
`Decl.make_env` is stateful, as it does a parse and decl and fold of the file and then updates the global state with the decls. This global state is then used in the next `Decl.make_env` call. This means that the files passed in first to `Decl.make_env` provide the decls for the later files passed in.
This is opposed to the Rust behavior:
https://www.internalfb.com/code/fbsource/[
dcfed651fdd7]/fbcode/hphp/hack/src/hackrs/decl_folded_class_ffi.rs?lines=88-106
Where we parse all of the files for decls and then update the shallow decl store. Then we fold all of the decls once the shallow decl store has all of the decls.
The OCaml behavior should match the rust behavior, which this diff addresses. We will first parse and decl all of the files - and then, once we have done this to all of the files, we will attempt to fold them.
Reviewed By: panopticoncentral
Differential Revision:
D39672218
fbshipit-source-id:
16b16434036378e13ce6c9e3c0d58067576b4e3d