Fix false positive "Expected TypedDict key to be string literal" for Union[TypedDict, dict[K, V]] (#21511)
When a variable is typed as `Union[TypedDict, dict[int, float]]`, mypy
incorrectly
raised `Expected TypedDict key to be string literal` when assigning a
dict literal
with non-string keys like `{1: 5.2}`. The plain `dict[int, float]`
alternative makes
the assignment valid, so this was a false positive.
The root cause was that `match_typeddict_call_with_dict`, which is used
as a probe to
check whether a dict literal could match a TypedDict, was emitting
errors from
`validate_typeddict_kwargs` during the matching phase rather than
silently returning
`False`. Wrapping the call in `filter_errors()` suppresses those
spurious diagnostics.
Fixes #21510
Co-authored-by: Claude Agent <agent@example.com>