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:
Douglas Eichelberger
2026-04-13 21:32:20 -07:00
parent 7a16cd6771
commit 5833a05338
2 changed files with 9 additions and 7 deletions
+8 -7
View File
@@ -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)
+1
View File
@@ -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