Skip to content

Commit

Permalink
Handle case of multiple previous primary unwinds to the same state
Browse files Browse the repository at this point in the history
  • Loading branch information
greysteil committed Sep 6, 2017
1 parent 4a8ea77 commit ae43c90
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 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 ae43c90

Please sign in to comment.