Skip to content

Commit 02e7eac

Browse files
committed
can we remove this here?
1 parent dd9abdf commit 02e7eac

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

crates/ty_python_semantic/src/types/signatures.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,19 +1292,11 @@ impl<'db> Parameters<'db> {
12921292
let class = nearest_enclosing_class(db, index, scope_id).unwrap();
12931293

12941294
Some(
1295-
// It looks like unnecessary work here that we create the implicit Self
1296-
// annotation using non-inferable typevars and then immediately apply
1297-
// `MarkTypeVarsInferable` to it. However, this is currently necessary to
1298-
// ensure that implicit-Self and explicit Self annotations are both treated
1299-
// the same. Marking type vars inferable will cause reification of lazy
1300-
// typevar defaults/bounds/constraints; this needs to happen for both
1301-
// implicit and explicit Self so they remain the "same" typevar.
1302-
typing_self(db, scope_id, typevar_binding_context, class, &Type::NonInferableTypeVar)
1303-
.expect("We should always find the surrounding class for an implicit self: Self annotation").apply_type_mapping(
1304-
db,
1305-
&TypeMapping::MarkTypeVarsInferable(None),
1306-
TypeContext::default()
1307-
)
1295+
typing_self(db, scope_id, typevar_binding_context, class, &Type::TypeVar)
1296+
.expect(
1297+
"We should always find the surrounding class \
1298+
for an implicit self: Self annotation",
1299+
),
13081300
)
13091301
} else {
13101302
// For methods of non-generic classes that are not otherwise generic (e.g. return `Self` or

0 commit comments

Comments
 (0)