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

Suppress sorbet type errors when using `undef' #18056

Merged
merged 2 commits into from
Aug 15, 2024

Conversation

dduugg
Copy link
Member

@dduugg dduugg commented Aug 15, 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?

Per discussion on #17998 this unblocks us from strict typing OS extensions (and a few other places), perhaps pending a re-architecture of how we approach such extensions.

I've also included a fix for #18008 (comment) and included the output of brew tc --update --suggest-typed

See https://sorbet.org/docs/error-reference#3008

Copy link
Member

@Bo98 Bo98 left a comment

Choose a reason for hiding this comment

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

Makes sense to me.

The problem the error is flagging isn't really a problem if we're always redefining the method again afterwards - it's simply telling us that Sorbet ignores undef which is OK as it's only there as a warning silencer.

Redefining is covered under 4010 which I assume works correctly given Sorbet ignores undef. In fact, Sorbet ignoring undef is in turn very useful for that reason.

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.

Nice, looks good, thanks @dduugg!

@MikeMcQuaid MikeMcQuaid merged commit 1172a2a into master Aug 15, 2024
25 checks passed
@MikeMcQuaid MikeMcQuaid deleted the suppress-undef-type-errors branch August 15, 2024 16:43
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