mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Avoid T.unsafe
.
This commit is contained in:
parent
d9712f4d50
commit
c6788bb27e
@ -230,6 +230,7 @@ end
|
|||||||
class UsesFromMacOSDependency < Dependency
|
class UsesFromMacOSDependency < Dependency
|
||||||
attr_reader :bounds
|
attr_reader :bounds
|
||||||
|
|
||||||
|
sig { params(name: String, tags: T::Array[Symbol], bounds: T::Hash[Symbol, Symbol]).void }
|
||||||
def initialize(name, tags = [], bounds:)
|
def initialize(name, tags = [], bounds:)
|
||||||
super(name, tags)
|
super(name, tags)
|
||||||
|
|
||||||
|
@ -3371,12 +3371,12 @@ class Formula
|
|||||||
# On Linux this will act as {.depends_on}.
|
# On Linux this will act as {.depends_on}.
|
||||||
sig {
|
sig {
|
||||||
params(
|
params(
|
||||||
dep: String,
|
dep: T.any(String, T::Hash[T.any(String, Symbol), T.any(Symbol, T::Array[Symbol])]),
|
||||||
bounds: T.any(Symbol, T::Array[Symbol]),
|
bounds: T::Hash[Symbol, Symbol],
|
||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def uses_from_macos(dep = T.unsafe(nil), **bounds)
|
def uses_from_macos(dep, bounds = {})
|
||||||
specs.each { |spec| spec.uses_from_macos(*dep, **bounds) }
|
specs.each { |spec| spec.uses_from_macos(dep, bounds) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# @!attribute [w] option
|
# @!attribute [w] option
|
||||||
|
@ -237,10 +237,9 @@ module Formulary
|
|||||||
bounds.deep_transform_values!(&:to_sym)
|
bounds.deep_transform_values!(&:to_sym)
|
||||||
|
|
||||||
if dep.is_a?(Hash)
|
if dep.is_a?(Hash)
|
||||||
dep.deep_transform_values!(&:to_sym)
|
uses_from_macos dep.deep_transform_values(&:to_sym).merge(bounds)
|
||||||
uses_from_macos(**T.unsafe(dep.merge(bounds)))
|
|
||||||
else
|
else
|
||||||
uses_from_macos dep, **bounds
|
uses_from_macos dep, bounds
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -188,18 +188,19 @@ class SoftwareSpec
|
|||||||
|
|
||||||
sig {
|
sig {
|
||||||
params(
|
params(
|
||||||
dep: String,
|
dep: T.any(String, T::Hash[T.any(String, Symbol), T.any(Symbol, T::Array[Symbol])]),
|
||||||
bounds: T.any(Symbol, T::Array[Symbol]),
|
bounds: T::Hash[Symbol, Symbol],
|
||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def uses_from_macos(dep = T.unsafe(nil), **bounds)
|
def uses_from_macos(dep, bounds = {})
|
||||||
bounds = bounds.dup
|
if dep.is_a?(Hash)
|
||||||
|
bounds = dep.dup
|
||||||
if dep
|
|
||||||
tags = []
|
|
||||||
else
|
|
||||||
dep, tags = bounds.shift
|
dep, tags = bounds.shift
|
||||||
|
dep = T.cast(dep, String)
|
||||||
tags = [*tags]
|
tags = [*tags]
|
||||||
|
bounds = T.cast(bounds, T::Hash[Symbol, Symbol])
|
||||||
|
else
|
||||||
|
tags = []
|
||||||
end
|
end
|
||||||
|
|
||||||
depends_on UsesFromMacOSDependency.new(dep, tags, bounds: bounds)
|
depends_on UsesFromMacOSDependency.new(dep, tags, bounds: bounds)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user