mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-09 21:28:21 +00:00
![]() 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. |
||
---|---|---|
.. | ||
mdtest | ||
primer | ||
README.md |
Markdown files within the mdtest/
subdirectory are tests of type inference and type checking;
executed by the tests/mdtest.rs
integration test.
See crates/ty_test/README.md
for documentation of this test format.