Type checking service: Introduce check and declare computation kinds
commit7e8095960322bf29495bd7eec6d1345a1a7d94a1
authorTatiana Racheva <tatianaracheva@fb.com>
Tue, 2 Jul 2019 01:10:22 +0000 (1 18:10 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Tue, 2 Jul 2019 01:14:07 +0000 (1 18:14 -0700)
tree976c9ca12f045c97a31bb2d38929f76a8c130071
parentfc76820bc6a33244ca89d8c78c505136c846ca0b
Type checking service: Introduce check and declare computation kinds

Summary:
Today, when we type check file `A.php`, we declare dependencies as we encounter them. This leads to bad type checking times on files that depend on a lot of classes. This is relevant in the case of generated files, for example.

The idea of this diff stack is to defer declaring dependencies and discard type errors for `A.php` if its dependencies weren't already available.

=====

Here, the `Type_checking_service` handles file jobs of two types:
1) `Check`: it's a file path and its symbols; we type check this file, like before
2) `Declare`: it's just a file path - we declare this file by forwarding it to `Decl_service`, which now exposes its `decl_file` function

Inside of `check_file`, we reset the set of deferred files, and after we're done, we:
1) EITHER return a set of deferred files converted into `Declare` jobs and a single `Check` job for the current file, which will be added to the queue of files to process
2) OR merge the errors we discovered in the file we type checked just now with the rest of the errors

NOTE: this change would not change any of the current behavior unless the type checker option was

Reviewed By: ljw1004

Differential Revision: D15869438

fbshipit-source-id: 3afe72a37239530da4a2b7d92a62f13c6c2333d4
hphp/hack/src/decl/decl_service.mli
hphp/hack/src/typing/typing_check_service.ml