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

Better union typing #204

Merged
merged 3 commits into from
Sep 14, 2020
Merged

Better union typing #204

merged 3 commits into from
Sep 14, 2020

Conversation

soutaro
Copy link
Owner

@soutaro soutaro commented Sep 14, 2020

Improves typing of method calls with block on union type receivers. This gives better types for:

a = [1, ""].sample    # a: Integer | String
a.yield_self do       # This cannot type blocks well because of the receiver is union type. 😢 
  ...
end

This PR is to introduce union and intersection of method types and using them solves the problem above.

@soutaro soutaro merged commit d4f628a into master Sep 14, 2020
@soutaro soutaro deleted the fix-union branch September 14, 2020 09:54
@soutaro soutaro mentioned this pull request Sep 15, 2020
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.

1 participant