Support vecs (1/2)
commit3d73a71a9405d183b266a2d1bffe8dcdea43e1db
authorSelina Kim <selinakim@fb.com>
Thu, 21 Jul 2022 03:14:52 +0000 (20 20:14 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Thu, 21 Jul 2022 03:14:52 +0000 (20 20:14 -0700)
tree177cbb724bd22b88ef4b029ecd8d6d8f1b303b54
parent5c3dd8698cf236b4b6492630350c730cb03a196f
Support vecs (1/2)

Summary:
It is now possible to initialize an empty vec, add function pointers to it, and then upcast its elements. This is not field-sensitive analysis, so the solver will report the upcast of any element of a vec that may contains a function pointer of interest.

Since vecs are copy-on-write, a new version of the vec is created when an array assignment occurs. Hence, the walker creates and tracks a new entity after `array_get` on a vec, and the new test vec2.php should report a single upcast corresponding to the version of the vec with `f<>`.

Reviewed By: madgen

Differential Revision: D37837411

fbshipit-source-id: 12ca0d8769b9a2c4eec595d7e98ca56a8032a2e8
hphp/hack/src/refactor_sd/refactor_sd_walker.ml
hphp/hack/test/refactor_sd/dump_constraints/vec.php [new file with mode: 0644]
hphp/hack/test/refactor_sd/dump_constraints/vec.php.exp [new file with mode: 0644]
hphp/hack/test/refactor_sd/dump_constraints/vec2.php [new file with mode: 0644]
hphp/hack/test/refactor_sd/dump_constraints/vec2.php.exp [new file with mode: 0644]
hphp/hack/test/refactor_sd/simplify_constraints/vec.php [new file with mode: 0644]
hphp/hack/test/refactor_sd/simplify_constraints/vec.php.exp [new file with mode: 0644]
hphp/hack/test/refactor_sd/simplify_constraints/vec2.php [new file with mode: 0644]
hphp/hack/test/refactor_sd/simplify_constraints/vec2.php.exp [new file with mode: 0644]