mirror of https://github.com/astral-sh/ruff
naming tweak
This commit is contained in:
parent
7806a459ed
commit
7c45d95d4a
|
|
@ -8011,7 +8011,7 @@ impl<'db> Type<'db> {
|
|||
) {
|
||||
let matching_typevar = |bound_typevar: &BoundTypeVarInstance<'db>| {
|
||||
match bound_typevar.typevar(db).kind(db) {
|
||||
TypeVarKind::Legacy | TypeVarKind::Pep613 | TypeVarKind::TypingSelf
|
||||
TypeVarKind::Legacy | TypeVarKind::Pep613Alias | TypeVarKind::TypingSelf
|
||||
if binding_context.is_none_or(|binding_context| {
|
||||
bound_typevar.binding_context(db)
|
||||
== BindingContext::Definition(binding_context)
|
||||
|
|
@ -9480,8 +9480,6 @@ impl<'db> FieldInstance<'db> {
|
|||
pub enum TypeVarKind {
|
||||
/// `T = TypeVar("T")`
|
||||
Legacy,
|
||||
/// `Alias: typing.TypeAlias = T`
|
||||
Pep613,
|
||||
/// `def foo[T](x: T) -> T: ...`
|
||||
Pep695,
|
||||
/// `typing.Self`
|
||||
|
|
@ -9490,6 +9488,8 @@ pub enum TypeVarKind {
|
|||
ParamSpec,
|
||||
/// `def foo[**P]() -> None: ...`
|
||||
Pep695ParamSpec,
|
||||
/// `Alias: typing.TypeAlias = T`
|
||||
Pep613Alias,
|
||||
}
|
||||
|
||||
impl TypeVarKind {
|
||||
|
|
|
|||
|
|
@ -5871,7 +5871,7 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
|
|||
self.db(),
|
||||
typevar.identity(self.db()).name(self.db()),
|
||||
typevar.identity(self.db()).definition(self.db()),
|
||||
TypeVarKind::Pep613,
|
||||
TypeVarKind::Pep613Alias,
|
||||
);
|
||||
Type::KnownInstance(KnownInstanceType::TypeVar(TypeVarInstance::new(
|
||||
self.db(),
|
||||
|
|
|
|||
|
|
@ -1003,7 +1003,7 @@ impl<'db> TypeInferenceBuilder<'db, '_> {
|
|||
// Annotated: TypeAlias = T
|
||||
// _: Annotated[int] = 1 # valid
|
||||
// ```
|
||||
if typevar.identity(self.db()).kind(self.db()) == TypeVarKind::Pep613 {
|
||||
if typevar.identity(self.db()).kind(self.db()) == TypeVarKind::Pep613Alias {
|
||||
self.infer_explicit_type_alias_specialization(subscript, value_ty, false)
|
||||
} else {
|
||||
if let Some(builder) =
|
||||
|
|
|
|||
Loading…
Reference in New Issue