@@ -535,8 +535,6 @@ def any_constraints(options: list[list[Constraint] | None], *, eager: bool) -> l
535535 if all (is_similar_constraints (valid_options [0 ], c ) for c in valid_options [1 :]):
536536 # All options have same structure. In this case we can merge-in trivial
537537 # options (i.e. those that only have Any) and try again.
538- # TODO: More generally, if a given (variable, direction) pair appears in
539- # every option, combine the bounds with meet/join always, not just for Any.
540538 trivial_options = select_trivial (valid_options )
541539 if 0 < len (trivial_options ) < len (valid_options ):
542540 merged_options = []
@@ -545,7 +543,10 @@ def any_constraints(options: list[list[Constraint] | None], *, eager: bool) -> l
545543 continue
546544 merged_options .append ([merge_with_any (c ) for c in option ])
547545 return any_constraints (list (merged_options ), eager = eager )
548- return sum (valid_options , [])
546+ # Solver will apply meets and joins as necessary, return everything we know.
547+ # Just deduplicate to reduce the amount of work.
548+ all_combined = sum (valid_options , [])
549+ return list (dict .fromkeys (all_combined ))
549550
550551 # If normal logic didn't work, try excluding trivially unsatisfiable constraint (due to
551552 # upper bounds) from each option, and comparing them again.
0 commit comments