Skip to content

Conversation

@cho-m
Copy link
Member

@cho-m cho-m commented Dec 22, 2025

  • 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?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

Part of #17297

Not sure if there is a better way to allow prepend-ed module to access instance variables without Sorbet complaining.

May be related to Sorbet's known limitations - https://sorbet.org/docs/unsupported#prepend

For now, using attr_reader and requires_ancestor to expose variables.

Copilot AI review requested due to automatic review settings December 22, 2025 22:19
Copy link
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

This PR upgrades the extend/os/linux/linkage_checker.rb file to use Sorbet's strict typing mode (typed: strict). To work around Sorbet's known limitations with prepended modules, the PR exposes instance variables through attr_reader methods and uses requires_ancestor to ensure type safety.

Key Changes

  • Added proper type signatures and Sorbet helpers to the Linux-specific LinkageChecker module
  • Exposed instance variables (indirect_deps, undeclared_deps, unwanted_system_dylibs, system_dylibs) as readable attributes in the base class
  • Converted direct instance variable access to method calls in the Linux override

Reviewed changes

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

File Description
Library/Homebrew/linkage_checker.rb Added attr_reader declarations for instance variables needed by the Linux-specific module, consolidated attribute declarations with proper type signatures
Library/Homebrew/extend/os/linux/linkage_checker.rb Upgraded to typed: strict, added Sorbet helpers and requires_ancestor, added type annotations, and converted instance variable access to method calls

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

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Dec 23, 2025
Merged via the queue into main with commit ff21ba4 Dec 23, 2025
45 of 46 checks passed
@MikeMcQuaid MikeMcQuaid deleted the linux-linkage_checker-typed-strict branch December 23, 2025 11:20
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.

3 participants