Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable typing in Ignorable #15114

Merged
merged 2 commits into from Apr 3, 2023
Merged

Conversation

dduugg
Copy link
Sponsor Member

@dduugg dduugg commented Mar 31, 2023

  • 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 style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Enables typing for the Ignorable and Debrew files.

Restores the upstream.rbi file to include type definitions that are necessary but not in our version of sorbet. (They're a pair of private methods, so pretending them with T.unsafe(self) doesn't work.)

@@ -99,7 +99,7 @@ def self.debrew
end

def self.debug(exception)
raise(exception) if !active? || !debugged_exceptions.add?(exception) || !try_lock
raise(exception) if !active? || !debugged_exceptions.add?(exception) || !mu_try_lock
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

This switches to using the mu_ methods bc sorbet doesn't recognize the aliased versions, but I believe they are equivalent:

[1] brew(main)> require 'debrew'
=> true
[2] brew(main)> $ Debrew.try_lock

From: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mutex_m.rb:86:
Owner: #<Class:Debrew>
Visibility: public
Signature: try_lock()
Number of lines: 3

def mu_try_lock
  @_mutex.try_lock
end

@@ -54,7 +54,7 @@ def self.update_test
start_commit = T.let("", T.untyped)
end_commit = "HEAD"
cd HOMEBREW_REPOSITORY do
start_commit = if (commit = T.let(args.commit, T.nilable(String)))
start_commit = if (commit = args.commit)
Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

Follow-up to #15104 (comment)

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.

Thanks again @dduugg!

@MikeMcQuaid MikeMcQuaid merged commit 830ec28 into Homebrew:master Apr 3, 2023
24 checks passed
@dduugg dduugg deleted the ignorable-type branch April 3, 2023 20:23
@github-actions github-actions bot added the outdated PR was locked due to age label May 4, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants