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