Skip to content

Conversation

@hyuraku
Copy link
Contributor

@hyuraku hyuraku commented Dec 16, 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

Copilot AI review requested due to automatic review settings December 16, 2025 13:12
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 lazy_object.rb from typed: true to typed: strict as part of the effort tracked in issue #17297 to improve type safety across the Homebrew codebase. The change adds Sorbet type signatures to all methods and initializes instance variables to satisfy strict mode requirements.

Key Changes:

  • Upgraded Sorbet strictness level from typed: true to typed: strict
  • Added type signatures (sig) to all methods: initialize, __getobj__, __setobj__, is_a?, class, and to_s
  • Initialized instance variables @__callable__ and @__getobj__ with T.let(nil, T.untyped) in the constructor to satisfy strict mode requirements

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

- use UNSET for better type safety
- to use a sentinel value for __getobj__ and improve initialization logic
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 great, thanks @hyuraku!

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Dec 17, 2025
Merged via the queue into Homebrew:main with commit 03c463a Dec 17, 2025
36 checks passed
@p-linnane
Copy link
Member

I'm now seeing intermittently seeing the following after this PR:

/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.4.0/gems/sorbet-runtime-0.6.12815/lib/types/private/methods/call_validation.rb:282: warning: the block passed to 'LazyObject#__getobj__' defined at /opt/homebrew/Library/Homebrew/lazy_object.rb:17 may be ignored

@samford
Copy link
Member

samford commented Dec 17, 2025

As mentioned internally, this is likely related to the use of LazyObject in Cask::Config. In the output Patrick posted internally, [only] homebrew/cask was being updated, so that makes sense. Can't say why it's happening but cask/config.rb and extend/os/linux/cask/config.rb are where LazyObject.new is called with a block.

@p-linnane
Copy link
Member

Fixed by #21271.

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.

4 participants