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
|
||||
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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user