8000 Improve Object#then and Object#yield_self signature by giovannibonetti · Pull Request #3155 · sorbet/sorbet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve Object#then and Object#yield_self signature #3155

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
Jun 5, 2020
Merged

Improve Object#then and Object#yield_self signature #3155

merged 1 commit into from
Jun 5, 2020

Conversation

giovannibonetti
Copy link
Contributor

Improve the accuracy of Object#then and Object#yield_self.
Instead of returning T.untyped it now returns the block output type.

I also wanted to add T.self_type to the block input type but it is currently not allowed.

class Object < BasicObject
  sig do
    type_parameters(:X)
      .params(blk: T.proc.params(arg: T.self_type).returns(T.type_parameter(:X)))
      .returns(T.type_parameter(:X))
  end
  def then(&blk); end
end
sorbet/hand-written-rbi/lib/object.rbi:6: Only top-level T.self_type is supported https://srb.help/5004
     6 |      .params(blk: T.proc.params(arg: T.self_type).returns(T.type_parameter(:X)))

Motivation

Based on #484

Test plan

I plan on waiting for the results of the existing tests and change them as necessary.

@giovannibonetti giovannibonetti requested a review from a team as a code owner June 5, 2020 19:33
@giovannibonetti giovannibonetti requested review from DarkDimius and removed request for a team June 5, 2020 19:33
@elliottt
Copy link
Collaborator
elliottt commented Jun 5, 2020

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_HPc3ZmAIDx3Tke

@elliottt elliottt requested review from elliottt and removed request for DarkDimius June 5, 2020 21:16
Copy link
Collaborator
@elliottt elliottt left a comment

Choose a reason for hiding this comment

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

Thanks! This will require some changes to stripe's codebase to land, so I'll take it from here.

@elliottt
Copy link
Collaborator
elliottt commented Jun 5, 2020

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_HPc3ZmAIDx3Tke

Build errors fixed in https://go/pull/239817

@elliottt elliottt merged commit 58251ac into sorbet:master Jun 5, 2020
@giovannibonetti
Copy link
Contributor Author

Thank you! 🙂

@giovannibonetti giovannibonetti deleted the patch-1 branch June 5, 2020 23:58
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.

2 participants
0