Basic flow analysis on if statements
Summary:
This will be the first in a bunch of diffs to support flow analysis for readonly. Here we remove the old behavior of erroring upon changing mutability of readonlyness, and instead use flow analysis to correctly deduce the most conservative type for a given variable in the local environment.
Note: this will be kinda slow in the beginning because we are copying so many environments around. I'll work on optimizing it once I can get the correctness there.
FWIW, the analysis will technically not be sound right now because we haven't implemented flow analysis on all the other control flow structures(switch, loops, etc), but by the end of the diff stack this should all be safe.
Reviewed By: oulgen
Differential Revision:
D30205978
fbshipit-source-id:
4b15189a821773519eba412410c8c5c1e990fa91