Skip to content

Commit 43da7c7

Browse files
committed
use existing method
1 parent a2e7a9f commit 43da7c7

File tree

2 files changed

+4
-25
lines changed

2 files changed

+4
-25
lines changed

crates/ty_python_semantic/src/types/generics.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -476,15 +476,6 @@ impl<'db> GenericContext<'db> {
476476
self.variables_inner(db).len()
477477
}
478478

479-
pub(crate) fn contains(
480-
self,
481-
db: &'db dyn Db,
482-
bound_typevar: BoundTypeVarInstance<'db>,
483-
) -> bool {
484-
self.variables_inner(db)
485-
.contains_key(&bound_typevar.identity(db))
486-
}
487-
488479
pub(crate) fn signature(self, db: &'db dyn Db) -> Signature<'db> {
489480
let parameters = Parameters::new(
490481
self.variables(db)

crates/ty_python_semantic/src/types/infer/builder.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5439,8 +5439,8 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
54395439
let parameter_type =
54405440
overload.signature.parameters()[*parameter_index].annotated_type()?;
54415441

5442-
// TODO: For now, skip any parameter annotations that mention any of the overload's
5443-
// typevars. There are two issues:
5442+
// TODO: For now, skip any parameter annotations that mention any typevars. There
5443+
// are two issues:
54445444
//
54455445
// First, if we include those typevars in the type context that we use to infer the
54465446
// corresponding argument type, the typevars might end up appearing in the inferred
@@ -5461,20 +5461,8 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
54615461
//
54625462
// Regardless, for now, the expedient "solution" is to not perform bidi type
54635463
// checking for these kinds of parameters.
5464-
if let Some(generic_context) = overload.signature.generic_context {
5465-
let mentions_overload_typevars = any_over_type(
5466-
db,
5467-
parameter_type,
5468-
&|ty| {
5469-
ty.as_typevar().is_some_and(|bound_typevar| {
5470-
generic_context.contains(db, bound_typevar)
5471-
})
5472-
},
5473-
true,
5474-
);
5475-
if mentions_overload_typevars {
5476-
return None;
5477-
}
5464+
if parameter_type.has_typevar(db) {
5465+
return None;
54785466
}
54795467

54805468
Some(parameter_type)

0 commit comments

Comments
 (0)