Closed
Description
When using mypy 1.6, this example produces no errors:
# mypy: strict-equality
from typing import Mapping
def f(x: dict[str, int | None], y: dict[str, str | None]) -> bool:
return x == y
def g(x: Mapping[str, int], y: str) -> bool:
return x == y
However, after #16237, it started generating these errors:
t.py:6: error: Non-overlapping equality check (left operand type: "dict[str, int | None]", right operand type: "dict[str, str | None]") [comparison-overlap]
t.py:9: error: Non-overlapping equality check (left operand type: "Mapping[str, int]", right operand type: "str") [comparison-overlap]
I'm not sure if the new behavior is better or not, but I suspect that the change in behavior may have been an unintended consequence of #16237, so it seems worth investigating what is going on.
cc @ilevkivskyi