Skip to content

Commit d1ef9b6

Browse files
committed
formula_installer: return nil from recursive_requirements block
The else branch ends with `unsatisfied_reqs[dependent] << req`, which returns an Array. This violates the block's declared return type of T.nilable(Symbol). Add an explicit nil return, matching the same pattern used in language/python.rb.
1 parent 7a16cd6 commit d1ef9b6

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

Library/Homebrew/formula.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,9 +2632,9 @@ def conflicts = T.must(self.class.conflicts)
26322632
block: T.nilable(
26332633
T.proc.params(
26342634
arg0: T.any(Formula, CaskDependent),
2635-
arg1: Dependency
2636-
).returns(T.nilable(Symbol))
2637-
)
2635+
arg1: Dependency,
2636+
).returns(T.nilable(Symbol)),
2637+
),
26382638
).returns(T::Array[Dependency])
26392639
}
26402640
def recursive_dependencies(&block)
@@ -2651,14 +2651,15 @@ def recursive_dependencies(&block)
26512651
# The full set of {Requirements} for this formula's dependency tree.
26522652
#
26532653
# @api internal
2654-
sig {
2654+
T::Sig::WithoutRuntime.sig {
2655+
# CaskDependent may not be initialized yet, so we don't use a runtime sig
26552656
params(
26562657
block: T.nilable(
26572658
T.proc.params(
26582659
arg0: T.any(Formula, CaskDependent, SoftwareSpec),
2659-
arg1: Requirement
2660-
).returns(T.nilable(Symbol))
2661-
)
2660+
arg1: Requirement,
2661+
).returns(T.nilable(Symbol)),
2662+
),
26622663
).returns(Requirements)
26632664
}
26642665
def recursive_requirements(&block)

Library/Homebrew/formula_installer.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,7 @@ def expand_requirements
736736
next Dependable::PRUNE
737737
else
738738
unsatisfied_reqs[dependent] << req
739+
nil # Return nil to satisfy T.nilable(Symbol) block sig (Array from << would violate it).
739740
end
740741
end
741742
end

0 commit comments

Comments
 (0)