Skip to content

Commit d392938

Browse files
committed
avoid multiple inference attempts with a single type context
1 parent e053c52 commit d392938

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
@@ -5981,14 +5981,14 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
59815981
call_expression_tcx: TypeContext<'db>,
59825982
) -> Result<(), CallErrorKind> {
59835983
let db = self.db();
5984+
59845985
// If the type context is a union, attempt to narrow to a specific element.
59855986
let narrow_targets: &[_] = match call_expression_tcx.annotation {
5986-
None => &[],
59875987
// TODO: We could theoretically attempt to narrow to every element of
59885988
// the power set of this union. However, this leads to an exponential
59895989
// explosion of inference attempts, and is rarely needed in practice.
59905990
Some(Type::Union(union)) => union.elements(db),
5991-
Some(ty) => &[ty],
5991+
_ => &[],
59925992
};
59935993

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

0 commit comments

Comments
 (0)