Regression for TypedDict default getattr
This generates an error on latest error but not on mypy 0.991
from typing import TypedDict
D = TypedDict("D", {"foo": int}, total=False)
def f(d: dict[str, D]) -> None:
args = d["a"]
args.update(d.get("b", {}))
mypy_primer -p test.py --bisect --debug --old v0.991 bisects this to #14178
cc @ilevkivskyi
Woah, I didn't know you could use mypy-primer in this way! I'll try it on the other regression. Thanks!
My PR just exposes existing issues (lack of proper union handling) like https://github.com/python/mypy/issues/13274. This is not easy to fix, since plugin for update() returns a TypedDict with no required keys. So even though this particular case will be fixed if we tweak equality for TypedDicts by ignoring fallback, it is easy to construct an example, that will still fail with the same errors.