diff --git a/crates/ty_python_semantic/src/types/infer/builder.rs b/crates/ty_python_semantic/src/types/infer/builder.rs index b2f8cc5687..f5d4f36a30 100644 --- a/crates/ty_python_semantic/src/types/infer/builder.rs +++ b/crates/ty_python_semantic/src/types/infer/builder.rs @@ -6894,10 +6894,14 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> { // Infer the type of each argument once with each distinct parameter type as type context. let parameter_types = overloads_with_binding .iter() - .filter_map(|(overload, binding)| parameter_type(overload, binding)) - .collect::>(); + .filter_map(|(overload, binding)| parameter_type(overload, binding)); + + let mut seen = FxHashSet::default(); for parameter_type in parameter_types { + if !seen.insert(parameter_type) { + continue; + } let inferred_ty = self.infer_expression(ast_argument, TypeContext::new(Some(parameter_type)));