Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flow][name-def] pass "conditional" context to more expressions in co…
…nditional positions Summary: In upcoming on natural inference, we need to determine if a primitive literals or variables appears in a context where increased precision is necessary. Consider for example the code ``` const one = 1; declare var x: number; if (x === one) { x as 1; // okay } ``` The position of `one` in the conditional needs to be considered as high precision, in other words we'd like to infer the instance of `one` there as `1` instead of `number`. This will allow the behavior of actually refining `x` to also be `1` and thus allow the cast, like we do today. This diff achieves this by pass a "conditional" context to a few more cases in Name_def: * members of the binary expression in `visit_binary_expression` * switch statement cases Changelog: [internal] Reviewed By: SamChou19815 Differential Revision: D70640801 fbshipit-source-id: 34d7cbdc3e04e7f5c63d9713e79f41f01e7a40f4
- Loading branch information