8000 Fix incorrect `json` sigs by ghiculescu · Pull Request #3296 · sorbet/sorbet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix incorrect json sigs #3296

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

Merged
merged 1 commit into from
Aug 6, 2020
Merged

Conversation

ghiculescu
Copy link
Contributor
@ghiculescu ghiculescu commented Jul 17, 2020

We are trying to update to json 2.3 (from 1.8). We use tapioca. After updating json and re-running tapioca we got these 3 errors from srb tc:

sorbet/rbi/gems/json@2.3.1.rbi:31: Method JSON.dump redefined without matching argument count. Expected: 2, got: 3 https://srb.help/4010
    31 |  def self.dump(obj, anIO = _, limit = _); end
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    https://github.com/sorbet/sorbet/tree/576e1fe628309d57783b13d7d7c7e7c546060b49/rbi/stdlib/json.rbi#L137: Previous definition
     137 |  def self.dump(obj, *args); end
            ^^^^^^^^^^^^^^^^^^^^^^^^^

sorbet/rbi/gems/json@2.3.1.rbi:36: Method JSON.generate redefined with argument opts as a non-splat argument https://srb.help/4010
    36 |  def self.generate(obj, opts = _); end
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    https://github.com/sorbet/sorbet/tree/576e1fe628309d57783b13d7d7c7e7c546060b49/rbi/stdlib/json.rbi#L193: The corresponding argument args in the previous definition was a splat argument
     193 |  def self.generate(obj, *args); end
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

sorbet/rbi/gems/json@2.3.1.rbi:47: Method JSON.pretty_generate redefined with argument opts as a non-splat argument https://srb.help/4010
    47 |  def self.pretty_generate(obj, opts = _); end
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    https://github.com/sorbet/sorbet/tree/576e1fe628309d57783b13d7d7c7e7c546060b49/rbi/stdlib/json.rbi#L312: The corresponding argument args in the previous definition was a splat argument
     312 |  def self.pretty_generate(obj, *args); end
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

As far as I can tell, in every case tapioca's sig is correct, and matches the method sig in the json gem in versions 2.3.1 and 1.8.6. Therefore I am updating the rbis to match.

We are trying to update to json 2.3 (from 1.8). We use tapioca. After updating `json` and re-running `tapioca` we got these 3 errors from `srb tc`:

```
sorbet/rbi/gems/json@2.3.1.rbi:31: Method JSON.dump redefined without matching argument count. Expected: 2, got: 3 https://srb.help/4010
    31 |  def self.dump(obj, anIO = _, limit = _); end
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    https://github.com/sorbet/sorbet/tree/576e1fe628309d57783b13d7d7c7e7c546060b49/rbi/stdlib/json.rbi#L137: Previous definition
     137 |  def self.dump(obj, *args); end
            ^^^^^^^^^^^^^^^^^^^^^^^^^

sorbet/rbi/gems/json@2.3.1.rbi:36: Method JSON.generate redefined with argument opts as a non-splat argument https://srb.help/4010
    36 |  def self.generate(obj, opts = _); end
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    https://github.com/sorbet/sorbet/tree/576e1fe628309d57783b13d7d7c7e7c546060b49/rbi/stdlib/json.rbi#L193: The corresponding argument args in the previous definition was a splat argument
     193 |  def self.generate(obj, *args); end
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

sorbet/rbi/gems/json@2.3.1.rbi:47: Method JSON.pretty_generate redefined with argument opts as a non-splat argument https://srb.help/4010
    47 |  def self.pretty_generate(obj, opts = _); end
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    https://github.com/sorbet/sorbet/tree/576e1fe628309d57783b13d7d7c7e7c546060b49/rbi/stdlib/json.rbi#L312: The corresponding argument args in the previous definition was a splat argument
     312 |  def self.pretty_generate(obj, *args); end
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

As far as I can tell, in every case tapioca's sig is correct, and matches the method sig in the [json gem](https://github.com/flori/json/blob/v2.3.1/lib/json/common.rb). Therefore I am updating the rbis to match.
@ghiculescu ghiculescu requested a review from a team as a code owner July 17, 2020 20:04
@ghiculescu ghiculescu requested review from jez and removed request for a team July 17, 2020 20:04
@elliottt
Copy link
Collaborator

We have a policy of testing changes to Sorbet against Stripe's codebase before
merging them. I've kicked off a test run for the current PR. When the build
finishes, I'll share with you whether or how it failed. Thanks!

Stripe employees can see the build result here:

https://go/builds/bui_HfL8Ilv4kCsYzz

@elliottt
Copy link
Collaborator

Thanks! This raised a few errors on Stripe's codebase, I'll have a look at addressing them on Monday.

@jez jez removed their request for review July 20, 2020 17:37
@marianosimone marianosimone added blocked on stripe rbi Inaccurate RBI type definitions labels Jul 21, 2020
@marianosimone marianosimone self-assigned this Aug 6, 2020
@marianosimone
Copy link
Contributor

We have a policy of testing changes to Sorbet against Stripe's codebase before
merging them. I've kicked off a test run for the current PR. When the build
finishes, I'll share with you whether or how it failed. Thanks!

Stripe employees can see the build result here:

https://go/builds/bui_HmqfHZmFZuELVx

@marianosimone marianosimone merged commit 1af7148 into sorbet:master Aug 6, 2020
@ghiculescu ghiculescu deleted the json-sigs branch August 6, 2020 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rbi Inaccurate RBI type definitions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0