diff --git a/Library/Homebrew/dependency.rb b/Library/Homebrew/dependency.rb index 6f3b88c8a2..8896435b67 100644 --- a/Library/Homebrew/dependency.rb +++ b/Library/Homebrew/dependency.rb @@ -230,6 +230,7 @@ end class UsesFromMacOSDependency < Dependency attr_reader :bounds + sig { params(name: String, tags: T::Array[Symbol], bounds: T::Hash[Symbol, Symbol]).void } def initialize(name, tags = [], bounds:) super(name, tags) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 9120a5cd8d..1a22f760b0 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -3371,12 +3371,12 @@ class Formula # On Linux this will act as {.depends_on}. sig { params( - dep: String, - bounds: T.any(Symbol, T::Array[Symbol]), + dep: T.any(String, T::Hash[T.any(String, Symbol), T.any(Symbol, T::Array[Symbol])]), + bounds: T::Hash[Symbol, Symbol], ).void } - def uses_from_macos(dep = T.unsafe(nil), **bounds) - specs.each { |spec| spec.uses_from_macos(*dep, **bounds) } + def uses_from_macos(dep, bounds = {}) + specs.each { |spec| spec.uses_from_macos(dep, bounds) } end # @!attribute [w] option diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 2cfe6b8f0e..584f4f4431 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -237,10 +237,9 @@ module Formulary bounds.deep_transform_values!(&:to_sym) if dep.is_a?(Hash) - dep.deep_transform_values!(&:to_sym) - uses_from_macos(**T.unsafe(dep.merge(bounds))) + uses_from_macos dep.deep_transform_values(&:to_sym).merge(bounds) else - uses_from_macos dep, **bounds + uses_from_macos dep, bounds end end end diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index a6e9776aa2..8dd3630877 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -188,18 +188,19 @@ class SoftwareSpec sig { params( - dep: String, - bounds: T.any(Symbol, T::Array[Symbol]), + dep: T.any(String, T::Hash[T.any(String, Symbol), T.any(Symbol, T::Array[Symbol])]), + bounds: T::Hash[Symbol, Symbol], ).void } - def uses_from_macos(dep = T.unsafe(nil), **bounds) - bounds = bounds.dup - - if dep - tags = [] - else + def uses_from_macos(dep, bounds = {}) + if dep.is_a?(Hash) + bounds = dep.dup dep, tags = bounds.shift + dep = T.cast(dep, String) tags = [*tags] + bounds = T.cast(bounds, T::Hash[Symbol, Symbol]) + else + tags = [] end depends_on UsesFromMacOSDependency.new(dep, tags, bounds: bounds)