pytorch
4dce482a - dict type unification fix (#32185)

Commit
4 years ago
dict type unification fix (#32185) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/32185 Previously we would unify the contained types of dictionaries, however this breaks type safety. ``` torch.jit.script def test(input: Dict[str, None], cond): if cond: out = input else: out: {"1": 1} out["hi"] = 3 ``` This would only occur if a dictionary is being re-assigned across an if condition with different contained types, which is pretty unlikely. I tested `model_backward_compatibility` for all fb models and this didn't break anything. This PR is a precursor to alias analysis changes. Also fixes `Future` type unification. Because `Future` is an immutable type, it is okay to unify the contained type. Test Plan: Imported from OSS Differential Revision: D19398585 Pulled By: eellison fbshipit-source-id: ebc8812cdf5b6dba37b1cfbc2edc7d8c467b258c
Author
Elias Ellison
Parents
Loading