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

sorbet: Add a RBI file for utils/svn.rb typechecking #8705

Merged
merged 1 commit into from Sep 12, 2020

Conversation

issyl0
Copy link
Member

@issyl0 issyl0 commented Sep 12, 2020

  • 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 tests with your changes locally?

  • Needed to include Kernel otherwise Sorbet couldn't find the system_command method.
  • I've also attempted to construct method signatures for all the methods.
  • Before, brew typecheck surfaced 36 errors. Now we're down to 33 errors.

- Needed to `include Kernel` otherwise Sorbet couldn't find the
  `system_command` method.
- I've also attempted to construct method signatures for all the methods.
- Before, `brew typecheck` surfaced 36 errors. Now we're down to 33 errors.
@reitermarkus
Copy link
Member

Needed to include Kernel otherwise Sorbet couldn't find the system_command method.

Is there a way to include this globally? This is included in all Ruby objects inheriting from Object.

@vidusheeamoli
Copy link
Contributor

Needed to include Kernel otherwise Sorbet couldn't find the system_command method.

Is there a way to include this globally? This is included in all Ruby objects inheriting from Object.

From Sorbet's documentation: Kernel is included in Object (which classes default to inheriting from), but not on BasicObject (which classes can optionally inherit from).

Sorbet requires that we explicitly require Kernel in all our modules.

Copy link
Contributor

@vidusheeamoli vidusheeamoli 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 to me! This PR, along with #8707 and #8706 would take down errors from 36 to 18. 🎉

@reitermarkus
Copy link
Member

From Sorbet's documentation: Kernel is included in Object

Then why isn't it included in every module? Don't modules inherit from Object? Or does it distinguish between the stdlib's Kernel and our extension to it?

@issyl0
Copy link
Member Author

issyl0 commented Sep 12, 2020

Is there a way to [include Kernel] globally? This is included in all Ruby objects inheriting from Object.

That would be nice - we're up to 21 separate include Kernel lines in our handwritten RBI files now! The Sorbet docs (step 4) recommend include Kernel explicitly, and another blog post I found states:

To resolve this, I need to include Kernel in the module. I suppose this will be necessary on every class that calls raise. This seems a shame since the Kernel module is already included in every ruby Object class (cite), though I understand one can override methods like puts, raise, and sleep if you really wanted to.

@reitermarkus
Copy link
Member

I guess you could theoretically include a module in a BasicObject, that's why it needs to be explicit.

@issyl0 issyl0 merged commit f9dd8ae into Homebrew:master Sep 12, 2020
@issyl0 issyl0 deleted the sorbet-svn-rbi branch September 12, 2020 17:04
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Dec 12, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 12, 2020
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

4 participants