ruff/crates/ty_python_semantic/resources/mdtest/generics
Douglas Creager b705664d49
[ty] Handle typevars that have other typevars as a default (#17956)
It's possible for a typevar to list another typevar as its default
value:

```py
class C[T, U = T]: ...
```

When specializing this class, if a type isn't provided for `U`, we would
previously use the default as-is, leaving an unspecialized `T` typevar
in the specialization. Instead, we want to use what `T` is mapped to as
the type of `U`.

```py
reveal_type(C())  # revealed: C[Unknown, Unknown]
reveal_type(C[int]())  # revealed: C[int, int]
reveal_type(C[int, str]())  # revealed: C[int, str]
```

This is especially important for the `slice` built-in type.
2025-05-08 19:01:27 -04:00
..
legacy [ty] Handle typevars that have other typevars as a default (#17956) 2025-05-08 19:01:27 -04:00
pep695 [ty] Handle typevars that have other typevars as a default (#17956) 2025-05-08 19:01:27 -04:00
builtins.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00
scoping.md Rename Red Knot (#17820) 2025-05-03 19:49:15 +02:00