Skip to content

Commit 0629a65

Browse files
committed
avoid multiple inference attempts with a single type context
1 parent f576fa6 commit 0629a65

File tree

1 file changed

+2
-2
lines changed
  • crates/ty_python_semantic/src/types/infer

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5705,14 +5705,14 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
57055705
call_expression_tcx: TypeContext<'db>,
57065706
) -> Result<(), CallErrorKind> {
57075707
let db = self.db();
5708+
57085709
// If the type context is a union, attempt to narrow to a specific element.
57095710
let narrow_targets: &[_] = match call_expression_tcx.annotation {
5710-
None => &[],
57115711
// TODO: We could theoretically attempt to narrow to every element of
57125712
// the power set of this union. However, this leads to an exponential
57135713
// explosion of inference attempts, and is rarely needed in practice.
57145714
Some(Type::Union(union)) => union.elements(db),
5715-
Some(ty) => &[ty],
5715+
_ => &[],
57165716
};
57175717

57185718
// We silence diagnostics until we successfully narrow to a specific type.

0 commit comments

Comments
 (0)