mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-03 05:13:00 +00:00
This PR adds two new `ty_extensions` functions, `reveal_when_assignable_to` and `reveal_when_subtype_of`. These are closely related to the existing `is_assignable_to` and `is_subtype_of`, but instead of returning when the property (always) holds, it produces a diagnostic that describes _when_ the property holds. (This will let us construct mdtests that print out constraints that are not always true or always false — though we don't currently have any instances of those.) I did not replace _every_ occurrence of the `is_property` variants in the mdtest suite, instead focusing on the generics-related tests where it will be important to see the full detail of the constraint sets. As part of this, I also updated the mdtest harness to accept the shorter `# revealed:` assertion format for more than just `reveal_type`, and updated the existing uses of `reveal_protocol_interface` to take advantage of this. |
||
|---|---|---|
| .. | ||
| src | ||
| ty_extensions | ||
| vendor/typeshed | ||
| .gitignore | ||
| build.rs | ||
| Cargo.toml | ||
| README.md | ||
Vendored types for the stdlib
This crate vendors typeshed's stubs for the standard library. The vendored stubs can be found in crates/ty_vendored/vendor/typeshed. The file crates/ty_vendored/vendor/typeshed/source_commit.txt tells you the typeshed commit that our vendored stdlib stubs currently correspond to.
The typeshed stubs are updated every two weeks via an automated PR using the sync_typeshed.yaml workflow in the .github/workflows directory. This workflow can also be triggered at any time via workflow dispatch.