File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -411,18 +411,15 @@ def _infer_constraints(
411411 # When the template is a union, we are okay with leaving some
412412 # type variables indeterminate. This helps with some special
413413 # cases, though this isn't very principled.
414- result = any_constraints (
414+ if has_recursive_types (template ) and not has_recursive_types (actual ):
415+ return handle_recursive_union (template , actual , direction )
416+ return any_constraints (
415417 [
416418 infer_constraints_if_possible (t_item , actual , direction )
417419 for t_item in template .items
418420 ],
419421 eager = isinstance (actual , AnyType ),
420422 )
421- if result :
422- return result
423- elif has_recursive_types (template ) and not has_recursive_types (actual ):
424- return handle_recursive_union (template , actual , direction )
425- return []
426423
427424 # Remaining cases are handled by ConstraintBuilderVisitor.
428425 return template .accept (ConstraintBuilderVisitor (actual , direction , skip_neg_op ))
You can’t perform that action at this time.
0 commit comments