Unroll tail recursion, report parameter pessimisation
commit1181e5e4efef347aaa94085d83799924b6466587
authorVassil Mladenov <vmladenov@fb.com>
Wed, 25 May 2022 21:11:01 +0000 (25 14:11 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Wed, 25 May 2022 21:11:01 +0000 (25 14:11 -0700)
treebe4ccced582092506014063e656f9301db498c06
parentedc3424f4638728f0cb76b256d11472616e6ae3b
Unroll tail recursion, report parameter pessimisation

Summary:
The aggregation functions are roughly a fold with an accumulator that is a tuple of the patches and the status. However, we never really use the accumulator patches meaningfully. We always pass in `[]` and always concatenate the results onto the accumulator.

So, instead of doing the `acc`-`@` style, I changed the child call to be a simple `List.concat_map`. I then added a new post visitor function that consumes `node_patches` and `children_patches`.

This change adds it so that when we are done visiting a parameter, we report

- file name - useful for bucketing codegen and test
- declaration kind - useful for comparing functions, methods, closures
- if it had a type at all (common on closures), or if no pessimisation occured
- if it was pessimised whether it got `~`, `supportdyn`, or both (denoted `s`, `l`, or `sl`)
  - note: this depends on some in flight work to correctly target `nonnull` for pessimisation

Quick index:
- `nt` = no type
- `np` = not pessimised
- `p` = pessimised
- `s` = `supportdyn`
- `l` = `~`

Differential Revision: D36385350

fbshipit-source-id: dc1a9e3e63ea23e38178952c4ecd1ef10aae1744
hphp/hack/src/typing/typing_enforceability.ml