8000 Make flow-sensitivity understand instance_of? by marianosimone · Pull Request #3364 · sorbet/sorbet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Make flow-sensitivity understand instance_of? #3364

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

Closed
wants to merge 1 commit into from

Conversation

marianosimone
Copy link
Collaborator

This makes sure that, after calling instance_of? on an object, Sorbet
knows about the type.

Motivation

Fixes #48

Test plan

Added automated tests.

This makes sure that, after calling `instance_of?` on an object, Sorbet
knows about the type.

Fixes #48
@marianosimone marianosimone requested a review from a team as a code owner August 15, 2020 00:06
@marianosimone marianosimone requested review from DarkDimius and removed request for a team August 15, 2020 00:06
@marianosimone
Copy link
Collaborator Author

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_HptdmlRUXPlQhe

extend T::Sig

sig {params(x: T.any(A, B, C)).void}
def baz(x)
Copy link
Collaborator

Choose a reason for hiding this comment

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

please add following test

# typed: true
x = "s"
if x.instance_of?(Object)
  puts x
else 
  puts x
end

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, this is interesting. We discussed offline and realized that the solution is harder to implement than just doing this.

Will comment on the original ticket

Copy link
Collaborator
@DarkDimius DarkDimius left a comment

Choose a reason for hiding this comment

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

https://github.com/sorbet/sorbet/pull/3364/files#r470918946

I expect it to fail in surprising way

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.

flow-sensitivity should understand instance_of? (or we should warn about it)
2 participants
0