mirror of https://github.com/astral-sh/ruff
[ty] Remove `Self` from generic context when binding `Self` (#20364)
## Summary This mainly removes an internal inconsistency, where we didn't remove the `Self` type variable when eagerly binding `Self` to an instance type. It has no observable effect, apparently. builds on top of https://github.com/astral-sh/ruff/pull/20328 ## Test Plan None
This commit is contained in:
parent
25cbf38a47
commit
2a6dde4acb
|
|
@ -6777,8 +6777,15 @@ impl<'db> TypeMapping<'_, 'db> {
|
||||||
| TypeMapping::PromoteLiterals
|
| TypeMapping::PromoteLiterals
|
||||||
| TypeMapping::BindLegacyTypevars(_)
|
| TypeMapping::BindLegacyTypevars(_)
|
||||||
| TypeMapping::MarkTypeVarsInferable(_)
|
| TypeMapping::MarkTypeVarsInferable(_)
|
||||||
| TypeMapping::Materialize(_)
|
| TypeMapping::Materialize(_) => context,
|
||||||
| TypeMapping::BindSelf(_) => context,
|
TypeMapping::BindSelf(_) => GenericContext::from_typevar_instances(
|
||||||
|
db,
|
||||||
|
context
|
||||||
|
.variables(db)
|
||||||
|
.iter()
|
||||||
|
.filter(|var| !var.typevar(db).is_self(db))
|
||||||
|
.copied(),
|
||||||
|
),
|
||||||
TypeMapping::ReplaceSelf { new_upper_bound } => GenericContext::from_typevar_instances(
|
TypeMapping::ReplaceSelf { new_upper_bound } => GenericContext::from_typevar_instances(
|
||||||
db,
|
db,
|
||||||
context.variables(db).iter().map(|typevar| {
|
context.variables(db).iter().map(|typevar| {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue