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

Adjust typing around #check_pull_requests #18217

Merged

Conversation

samford
Copy link
Member

@samford samford commented Aug 31, 2024

  • 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?

brew bump-formula-pr is encountering a type error (e.g., as seen in a recent homebrew/core autobump run), as the inferred return type of GitHub#check_for_duplicate_pull_requests doesn't align with the explicit return type of #check_pull_requests:

Error: Return value: Expected type T.nilable(T::Array[String]), got type Module with value T::Private::Types::Void::VOID
Caller: /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/bump-formula-pr.rb:137
Definition: /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/bump-formula-pr.rb:472 (Homebrew::DevCmd::BumpFormulaPr#check_pull_requests)

This addresses the issue by adding a type signature with a void return type to #check_for_duplicate_pull_requests and setting the return type of #check_pull_requests to void as well. The return type from #check_pull_requests isn't used, so a void return type is arguably a better reflection of the method's behavior. The #check_pull_requests method in BumpCaskPr has a void return type, so this change brings the BumpFormulaPr method in line.

`brew bump-formula-pr` is encountering a type error, as the inferred
return type of `GitHub#check_for_duplicate_pull_requests` doesn't
align with the explicit return type of `#check_pull_requests`:

```
Error: Return value: Expected type T.nilable(T::Array[String]), got
  type Module with value T::Private::Types::Void::VOID
Caller: /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/dev-cmd/
  bump-formula-pr.rb:137
Definition: /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/
  dev-cmd/bump-formula-pr.rb:472 (Homebrew::DevCmd::BumpFormulaPr
  #check_pull_requests)
```

This addresses the issue by adding a type signature with a `void`
return type to `#check_for_duplicate_pull_requests` and setting the
return type of `#check_pull_requests` to `void` as well. The return
type from `#check_pull_requests` isn't used, so a `void` return type
is arguably a better reflection of the method's behavior. The
`#check_pull_requests` method in `BumpCaskPr` has a `void` return
type, so this change brings the `BumpFormulaPr` method in line.
@samford samford added the bug Reproducible Homebrew/brew bug label Aug 31, 2024
@carlocab carlocab merged commit 64e0c58 into Homebrew:master Aug 31, 2024
27 checks passed
@samford samford deleted the adjust-typing-around-check_pull_requests branch August 31, 2024 21:14
@MikeMcQuaid
Copy link
Member

Thanks @samford!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reproducible Homebrew/brew bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants