[ty] _typeshed.Self is not a special form (#18377)
Some checks are pending
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux) (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run

## Summary

This change was based on a mis-reading of a comment in typeshed, and a
wrong assumption about what was causing a test failure in a prior PR.
Reverting it doesn't cause any tests to fail.

## Test Plan

Existing tests.
This commit is contained in:
Carl Meyer 2025-05-29 17:11:13 -07:00 committed by GitHub
parent 9b0dfc505f
commit 363f061f09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -79,7 +79,7 @@ pub enum SpecialFormType {
/// The symbol `typing.Callable`
/// (which can also be found as `typing_extensions.Callable` or as `collections.abc.Callable`)
Callable,
/// The symbol `typing.Self` (which can also be found as `typing_extensions.Self` or `_typeshed.Self`)
/// The symbol `typing.Self` (which can also be found as `typing_extensions.Self`)
#[strum(serialize = "Self")]
TypingSelf,
/// The symbol `typing.Final` (which can also be found as `typing_extensions.Final`)
@ -227,16 +227,12 @@ impl SpecialFormType {
| Self::TypeGuard
| Self::TypedDict
| Self::TypeIs
| Self::TypingSelf
| Self::Protocol
| Self::ReadOnly => {
matches!(module, KnownModule::Typing | KnownModule::TypingExtensions)
}
Self::TypingSelf => matches!(
module,
KnownModule::Typing | KnownModule::TypingExtensions | KnownModule::Typeshed
),
Self::Unknown
| Self::AlwaysTruthy
| Self::AlwaysFalsy