Skip to content

Fix requirement which override#22040

Merged
MikeMcQuaid merged 1 commit intomainfrom
fix-requirement-which-override
Apr 18, 2026
Merged

Fix requirement which override#22040
MikeMcQuaid merged 1 commit intomainfrom
fix-requirement-which-override

Conversation

@MikeMcQuaid
Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid commented Apr 17, 2026

Fixes #22036

  • preserve Requirement#which defaulting to ORIGINAL_PATHS
  • match Kernel#which arity and visibility for Sorbet
  • cover which inside satisfy(build_env: false) regression

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes. Non-maintainers may only have one AI-assisted/generated PR open at a time.

Used OpenAI Codex xhigh with manual review and testing.


- preserve `Requirement#which` defaulting to `ORIGINAL_PATHS`
- match `Kernel#which` arity and visibility for Sorbet
- cover `which` inside `satisfy(build_env: false)` regression
Copilot AI review requested due to automatic review settings April 17, 2026 19:57
@MikeMcQuaid MikeMcQuaid enabled auto-merge April 17, 2026 19:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Requirement#which so it properly overrides Homebrew’s Kernel#which (matching arity/visibility for Sorbet), while still defaulting to ORIGINAL_PATHS. Adds a regression spec to ensure which calls from satisfy(build_env: false) don’t error.

Changes:

  • Update Requirement#which to accept the same parameters as Kernel#which, use override, and make it public.
  • Preserve Requirement#which default path behavior (defaulting to ORIGINAL_PATHS).
  • Add a spec covering which usage inside satisfy(build_env: false).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Library/Homebrew/requirement.rb Aligns Requirement#which signature/visibility with Kernel#which while preserving the ORIGINAL_PATHS default.
Library/Homebrew/test/requirement_spec.rb Adds regression coverage for calling which inside satisfy(build_env: false).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Apr 18, 2026
Merged via the queue into main with commit 3aae056 Apr 18, 2026
40 checks passed
@MikeMcQuaid MikeMcQuaid deleted the fix-requirement-which-override branch April 18, 2026 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Requirement #which override incompatible with Kernel #which signature

3 participants