mirror of
https://github.com/Homebrew/brew.git
synced 2026-08-12 22:29:27 +04:00
Fix block return type violations and use WithoutRuntime sig
Add explicit nil return in formula_installer.rb where the else branch returns an Array from <<, violating the block's declared T.nilable(Symbol) return type. Use T::Sig::WithoutRuntime for Formula#recursive_requirements (matching recursive_dependencies) since CaskDependent may not be initialized yet.
This commit is contained in:
@@ -2632,9 +2632,9 @@ class Formula
|
||||
block: T.nilable(
|
||||
T.proc.params(
|
||||
arg0: T.any(Formula, CaskDependent),
|
||||
arg1: Dependency
|
||||
).returns(T.nilable(Symbol))
|
||||
)
|
||||
arg1: Dependency,
|
||||
).returns(T.nilable(Symbol)),
|
||||
),
|
||||
).returns(T::Array[Dependency])
|
||||
}
|
||||
def recursive_dependencies(&block)
|
||||
@@ -2651,14 +2651,15 @@ class Formula
|
||||
# The full set of {Requirements} for this formula's dependency tree.
|
||||
#
|
||||
# @api internal
|
||||
sig {
|
||||
T::Sig::WithoutRuntime.sig {
|
||||
# CaskDependent may not be initialized yet, so we don't use a runtime sig
|
||||
params(
|
||||
block: T.nilable(
|
||||
T.proc.params(
|
||||
arg0: T.any(Formula, CaskDependent, SoftwareSpec),
|
||||
arg1: Requirement
|
||||
).returns(T.nilable(Symbol))
|
||||
)
|
||||
arg1: Requirement,
|
||||
).returns(T.nilable(Symbol)),
|
||||
),
|
||||
).returns(Requirements)
|
||||
}
|
||||
def recursive_requirements(&block)
|
||||
|
||||
@@ -736,6 +736,7 @@ on_request: installed_on_request?, options:)
|
||||
next Dependable::PRUNE
|
||||
else
|
||||
unsatisfied_reqs[dependent] << req
|
||||
nil # Return nil to satisfy T.nilable(Symbol) block sig (Array from << would violate it).
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user