diff --git a/Library/Homebrew/dependencies.rb b/Library/Homebrew/dependencies.rb index 3e8bd125e8..354b12745e 100644 --- a/Library/Homebrew/dependencies.rb +++ b/Library/Homebrew/dependencies.rb @@ -39,6 +39,11 @@ class Dependencies < SimpleDelegator def inspect "#<#{self.class.name}: #{__getobj__}>" end + + sig { returns(T::Array[Dependency]) } + def to_a + __getobj__.to_a + end end # A collection of requirements. diff --git a/Library/Homebrew/formula_cellar_checks.rb b/Library/Homebrew/formula_cellar_checks.rb index 93cf4b9d7e..26e4f2f066 100644 --- a/Library/Homebrew/formula_cellar_checks.rb +++ b/Library/Homebrew/formula_cellar_checks.rb @@ -191,7 +191,7 @@ module FormulaCellarChecks EOS end - sig { params(lib: Pathname, deps: T::Array[Dependency]).returns(T.nilable(String)) } + sig { params(lib: Pathname, deps: Dependencies).returns(T.nilable(String)) } def check_python_packages(lib, deps) return unless lib.directory? @@ -209,7 +209,8 @@ module FormulaCellarChecks return if pythons.blank? - python_deps = deps.map(&:name) + python_deps = deps.to_a + .map(&:name) .grep(/^python(@.*)?$/) .filter_map { |d| Formula[d].version.to_s[/^\d+\.\d+/] }