pyrefly
pyrefly copied to clipboard
fix Contextual typing works only with the first element in a union #793
fix #793
Added collect_var_from_hint/hint_from_types to gather element candidates across union branches and reused them in the container decomposers to keep contextual hints from collapsing to the first branch
Taught list inference to try each union branch with its own hint before falling back, plus factored the existing logic into a reusable helper
Unblocked the regression test by removing the expected errors and bug marker now that the behavior is fixed
cc @samwgoldman @grievejia for review
@stroxler has imported this pull request. If you are a Meta employee, you can view this in D87788142.