declare_folded_class NO LONGER _in_file
commit8652937c452fa64de7f84b6e44e1100226abc459
authorLucian Wischik <ljw@meta.com>
Wed, 16 Nov 2022 23:49:39 +0000 (16 15:49 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Wed, 16 Nov 2022 23:49:39 +0000 (16 15:49 -0800)
tree2b682afd419918357489bfd95b0d5796fe985ffc
parent8c51cb05c277f1dd0a1734167eb20da449064d3a
declare_folded_class NO LONGER _in_file

Summary:
If we were typechecking a.php, and we had to fold class C, then we used to invoke
```
declare_folded_class_in_file ctx "c.php" "C"
```
That filename "c.php" used to be used, I think, as the filename under which errors were reported in the errors.ml function "let add_error ...". It was introduced in D4113886 (https://github.com/facebook/hhvm/commit/67934a66fd9b50d64789eeb55da32099a756d7a6) (Nov 2016) and undone in D6730499 (https://github.com/facebook/hhvm/commit/8b1b511a3bc036f5429e8151b0c60211ea0a616d) (Jan 2018). The state since Jan 2018 is that now, when it reports errors during decling, then it reports them with respect to the current file we're typechecking.

The old behavior was quite dodgy. We have a cast-iron invariant that any errors that arise during typechecking of file a.php must be reported as coming from a.php. The errors that arise during decling don't fit into this paradigm, and therefore there must be no errors that arise during decling, but if they are then they should still be reported in a.php. (I believe they are).

Anyway, the upshot is that since Jan 2018, even though we used to pass in a filename, we never used that filename.

This diff removes the filename.

## How to read this diff

1. Start with errors.ml. That shows that the filename is no longer used; I replace `in_lazy_decl: Relative_path.t option ref` with `in_lazy_decl: bool ref`.
2. Next read typing_classes_heap.ml. It used to fetch the class's path. Now it merely tests whether the class exists.
3. Next read decl_provider.ml. It used to be that if typing_classes_heap had read the path for the pathname but it failed to class_decl then it would raise an exception "<class> not found in <file>". Now in this case it just raises the exception "<class> not found". (After all, we're looking for the class everywhere, not just in one specific file).
4. The rest of the changes are just straightforward consequences of renaming and removing the filename parameter

Reviewed By: CatherineGasnier

Differential Revision: D41321333

fbshipit-source-id: 40066b1bacf83dfd3eee5a3b457294e54a0bebab
hphp/hack/src/decl/decl_export.ml
hphp/hack/src/errors/errors.ml
hphp/hack/src/errors/errors.mli
hphp/hack/src/hackrs/compare_folded_decls_file.ml
hphp/hack/src/providers/decl_provider.ml
hphp/hack/src/providers/decl_provider.mli
hphp/hack/src/providers/typedef_provider.ml
hphp/hack/src/providers/typedef_provider.mli
hphp/hack/src/typing/typing_classes_heap.ml
hphp/hack/src/typing/typing_classes_heap.mli