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

Teach guessOverload to respect block arity #7859

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jez
Copy link
Collaborator

@jez jez commented Apr 25, 2024

Motivation

Fixes #7743

Sometimes it's useful to be able to use the arity of the block to guess an
overload.

This isn't perfect for all the reasons that overload checking isn't
perfect, but there are some places where this is useful, especially in
abstractions that check the proc's arity when deciding how to call the
block.

This is also a pre-requisite for doing something like #7741, which is a
partial fix for #3914 / #4149, where we infer the types of
Kernel#lambda blocks by codegenerating overloaded signatures.

Test plan

See included automated tests, which show the master behavior and how it changes.

jez added 2 commits April 25, 2024 16:20
Sometimes it's useful to be able to use the arity of the block to guess
an overload.

This isn't perfect for all the reasons that overload checking isn't
perfect, but there are some places where this is useful, especially in
abstractions that check the proc's arity when deciding how to call the
block.

This is also a pre-requisite for doing something like #7741, which is a
partial fix for #3914 / #4149, where we infer the types of
`Kernel#lambda` blocks by codegenerating overloaded signatures.
@jez jez requested a review from a team as a code owner April 25, 2024 21:24
@jez jez requested review from froydnj and removed request for a team April 25, 2024 21:24
@jez
Copy link
Collaborator Author

jez commented Apr 25, 2024

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 results here:

https://go/builds/bui_PzYwe4JrCo8jCG
https://go/builds/bui_PzYwg1tOdYrvpv
https://go/builds/bui_PzYwC4goCJNmW3

@jez
Copy link
Collaborator Author

jez commented Apr 26, 2024

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 results here:

https://go/builds/bui_PzcarmQnhPi08z
https://go/builds/bui_PzcaAoQONvLdzK
https://go/builds/bui_PzcaXiCRmeaN0d

@jez jez marked this pull request as draft April 26, 2024 15:09
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.

Block arity isn't considered for overloads
1 participant