Skip to content

Commit

Permalink
Merge pull request #86 from CocoaPods/multiple-primary-unwinds
Browse files Browse the repository at this point in the history
Handle case of multiple previous primary unwinds to the same state
  • Loading branch information
segiddins committed Sep 6, 2017
2 parents 4a8ea77 + a57eefd commit f525dae
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@

##### Bug Fixes

* None.
* Handle the case where an unwind occurs to a requirement that directly caused
the current conflict but could also have been unwound to directly from
previous conflicts. In this case, filtering must not remove any possibilities
that could have avoided the previous conflicts (even if they would not avoid
the current one).
[Grey Baker](https://github.com/greysteil)


## 0.6.2 (2017-08-25)
Expand Down
8 changes: 6 additions & 2 deletions lib/molinillo/resolution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -461,11 +461,15 @@ def filter_possibilities_after_unwind(unwind_details)
# @param [UnwindDetails] details of the conflict just unwound from
# @return [void]
def filter_possibilities_for_primary_unwind(unwind_details)
all_requirements = unwind_details.conflicting_requirements
unwinds_to_state = unused_unwind_options.select { |uw| uw.state_index == unwind_details.state_index }
unwinds_to_state << unwind_details
unwind_requirement_sets = unwinds_to_state.map(&:conflicting_requirements)

state.possibilities.reject! do |possibility_set|
possibility_set.possibilities.none? do |poss|
possibility_satisfies_requirements?(poss, all_requirements)
unwind_requirement_sets.any? do |requirements|
possibility_satisfies_requirements?(poss, requirements)
end
end
end
end
Expand Down

0 comments on commit f525dae

Please sign in to comment.