ruff/crates/ty_python_semantic
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
..
resources [ty] Handle typevars that have other typevars as a default (#17956) 2025-05-08 19:01:27 -04:00
src [ty] Handle typevars that have other typevars as a default (#17956) 2025-05-08 19:01:27 -04:00
tests Use #[expect(lint)] over #[allow(lint)] where possible (#17822) 2025-05-03 21:20:31 +02:00
build.rs
Cargo.toml
mdtest.py
mdtest.py.lock