summaryrefslogtreecommitdiff
path: root/lib/rubygems/resolver
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/resolver')
-rw-r--r--lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb2
-rw-r--r--lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb10
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb b/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb
index 1a82da0e7a..4170b00af0 100644
--- a/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb
+++ b/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Gem::Resolver::Molinillo
# The version of Gem::Resolver::Molinillo.
- VERSION = '0.5.0'.freeze
+ VERSION = '0.5.1'.freeze
end
diff --git a/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb b/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb
index 1fb7a1e921..e6565119ef 100644
--- a/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb
+++ b/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb
@@ -184,6 +184,8 @@ module Gem::Resolver::Molinillo
raise VersionConflict.new(c) unless state
activated.rewind_to(sliced_states.first || :initial_state) if sliced_states
state.conflicts = c
+ index = states.size - 1
+ @parent_of.reject! { |_, i| i >= index }
end
end
@@ -209,7 +211,10 @@ module Gem::Resolver::Molinillo
# @return [Object] the requirement that led to `requirement` being added
# to the list of requirements.
def parent_of(requirement)
- @parent_of[requirement]
+ return unless requirement
+ return unless index = @parent_of[requirement]
+ return unless parent_state = @states[index]
+ parent_state.requirement
end
# @return [Object] the requirement that led to a version of a possibility
@@ -418,7 +423,8 @@ module Gem::Resolver::Molinillo
debug(depth) { "Requiring nested dependencies (#{nested_dependencies.join(', ')})" }
nested_dependencies.each do |d|
activated.add_child_vertex(name_for(d), nil, [name_for(activated_spec)], d)
- @parent_of[d] = requirement
+ parent_index = states.size - 1
+ @parent_of[d] ||= parent_index
end
push_state_for_requirements(requirements + nested_dependencies, !nested_dependencies.empty?)