ruff/crates/red_knot_python_semantic/resources/mdtest/call
Carl Meyer 2a478ce1b2
[red-knot] simplify gradually-equivalent types out of unions and intersections (#17467)
## Summary

If two types are gradually-equivalent, that means they share the same
set of possible materializations. There's no need to keep two such types
in the same union or intersection; we should simplify them.

Fixes https://github.com/astral-sh/ruff/issues/17465

The one downside here is that now we will simplify e.g. `Unknown |
Todo(...)` to just `Unknown`, if `Unknown` was added to the union first.
This is correct from a type perspective (they are equivalent types), but
it can mean we lose visibility into part of the cause for the type
inferring as unknown. I think this is OK, but if we think it's important
to avoid this, I can add a special case to try to preserve `Todo` over
`Unknown`, if we see them both in the same union or intersection.

## Test Plan

Added and updated mdtests.
2025-04-18 15:08:57 -07:00
..
annotation.md red_knot_python_semantic: replace one use of "old" secondary diagnostic messages 2025-04-10 13:21:00 -04:00
builtins.md [red-knot] Three-argument type-calls take 'str' as the first argument (#17168) 2025-04-03 15:45:08 +02:00
callable_instance.md red_knot_python_semantic: replace one use of "old" secondary diagnostic messages 2025-04-10 13:21:00 -04:00
constructor.md red_knot_python_semantic: replace one use of "old" secondary diagnostic messages 2025-04-10 13:21:00 -04:00
dunder.md Fix member lookup for unions & intersections ignoring policy (#17066) 2025-03-31 09:40:47 +02:00
function.md [red-knot] Detect version-related syntax errors (#16379) 2025-04-17 14:00:30 -04:00
getattr_static.md [red-knot] improve function/bound method type display (#17294) 2025-04-14 15:56:18 -07:00
invalid_syntax.md red_knot_python_semantic: replace one use of "old" secondary diagnostic messages 2025-04-10 13:21:00 -04:00
methods.md [red-knot] Handle explicit class specialization in type expressions (#17434) 2025-04-18 11:49:22 -04:00
never.md [red-knot] Never is callable and iterable. Arbitrary attributes can be accessed. (#16533) 2025-03-06 15:59:19 +00:00
str_startswith.md [red-knot] Specialize str.startswith for string literals (#17351) 2025-04-11 16:26:45 +02:00
subclass_of.md red_knot_python_semantic: replace one use of "old" secondary diagnostic messages 2025-04-10 13:21:00 -04:00
union.md [red-knot] simplify gradually-equivalent types out of unions and intersections (#17467) 2025-04-18 15:08:57 -07:00