Skip to content

Commit 7d3cec6

Browse files
committed
don't search for legacy typevars in newtypes
1 parent f0341d7 commit 7d3cec6

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

crates/ty_python_semantic/src/types.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7215,13 +7215,10 @@ impl<'db> Type<'db> {
72157215
instance.find_legacy_typevars_impl(db, binding_context, typevars, visitor);
72167216
}
72177217

7218-
Type::NewTypeInstance(newtype) => {
7219-
newtype.base_class_type(db).find_legacy_typevars_impl(
7220-
db,
7221-
binding_context,
7222-
typevars,
7223-
visitor,
7224-
);
7218+
Type::NewTypeInstance(_) => {
7219+
// A newtype can never be constructed from an unspecialized generic class, so it is
7220+
// impossible that we could ever find any legacy typevars in a newtype instance or
7221+
// its underlying class.
72257222
}
72267223

72277224
Type::SubclassOf(subclass_of) => {

0 commit comments

Comments
 (0)