Change explicit declaration step in ServerIdeUtils to use Decl.name_and_declare_types...
commit77b8538f1f6f8d97470364bbc09eae1b39be43c5
authorKasper Kopec <kasper@fb.com>
Wed, 14 Dec 2016 02:51:42 +0000 (13 18:51 -0800)
committerHhvm Bot <hhvm-bot-bot@fb.com>
Thu, 15 Dec 2016 20:24:28 +0000 (15 12:24 -0800)
tree44abda5b08b88b74a8f54c00317807e90f10ad1e
parentcff41ef90d5e956550bfbde14849771a9a58153a
Change explicit declaration step in ServerIdeUtils to use Decl.name_and_declare_types_program

Summary:
There is a comment there explaining why is was necessary, but I think it's not true any more (since D3234660).

Moreover, as pointed out by dlreeves, there is no reason why this code would work now (and it probably doesn't - Decl_heap_elems_bug anyone?) - all of those Decl. calls assume that parents are declared, which is not true in lazy decl world.

Initially I just removed this code, depending fully on lazy decl, but then realized that while typing will work, there might be hooks in decl phase that would not be executed, depending on whether something is lazily loaded or not (hard to tell whether it's something that actually happens). Instead of removing, switching it to name_and_declare_types_program that ensures that parents will be correctly declared too. As a side effect, naming is ran twice here - during name_and_declare_types_program, and as part of typing. I could probably refactor it to avoid it, but naming speed is negligible, and this code is scare to touch as it is.

Reviewed By: dlreeves

Differential Revision: D4318381

fbshipit-source-id: 9e181117d16763cd9dc8c69145045454ad9903b1
hphp/hack/src/server/serverIdeUtils.ml