From 7c45d95d4a3afbf1446a1615560db1a0484d6778 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Fri, 12 Dec 2025 15:28:12 -0800 Subject: [PATCH] naming tweak --- crates/ty_python_semantic/src/types.rs | 6 +++--- crates/ty_python_semantic/src/types/infer/builder.rs | 2 +- .../src/types/infer/builder/type_expression.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/ty_python_semantic/src/types.rs b/crates/ty_python_semantic/src/types.rs index 357dee3906..1d8e89cf89 100644 --- a/crates/ty_python_semantic/src/types.rs +++ b/crates/ty_python_semantic/src/types.rs @@ -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 { diff --git a/crates/ty_python_semantic/src/types/infer/builder.rs b/crates/ty_python_semantic/src/types/infer/builder.rs index 5bc223e4e1..c4cb02a88c 100644 --- a/crates/ty_python_semantic/src/types/infer/builder.rs +++ b/crates/ty_python_semantic/src/types/infer/builder.rs @@ -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(), diff --git a/crates/ty_python_semantic/src/types/infer/builder/type_expression.rs b/crates/ty_python_semantic/src/types/infer/builder/type_expression.rs index 70eb6ba7e5..d4c5701f1d 100644 --- a/crates/ty_python_semantic/src/types/infer/builder/type_expression.rs +++ b/crates/ty_python_semantic/src/types/infer/builder/type_expression.rs @@ -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) =