[ty] Improve diagnostics for unsupported binary operations and unsupported augmented assignments (#21947)

## Summary

This PR takes the improvements we made to unsupported-comparison
diagnostics in https://github.com/astral-sh/ruff/pull/21737, and extends
them to other `unsupported-operator` diagnostics.

## Test Plan

Mdtests and snapshots
This commit is contained in:
Alex Waygood
2025-12-12 21:53:29 +00:00
committed by GitHub
parent ca5f099481
commit 5a2aba237b
15 changed files with 401 additions and 107 deletions

View File

@@ -18,7 +18,7 @@ cannot be added, because that would require addition of `int` and `str` or vice
def f2(i: int, s: str, int_or_str: int | str):
i + i
s + s
# error: [unsupported-operator] "Operator `+` is not supported between objects of type `int | str` and `int | str`"
# error: [unsupported-operator] "Operator `+` is not supported between two objects of type `int | str`"
reveal_type(int_or_str + int_or_str) # revealed: Unknown
```