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

[activesupport] More accurate type for #try #181

Merged
merged 1 commit into from
Jul 14, 2022

Conversation

pocke
Copy link
Member

@pocke pocke commented Jul 14, 2022

This PR improves try method types.

Note that the type definition of NilClass#try is more strict than the implementation. nil.try raises no error but the type definition rejects it.
I think the strict behavior is better because it is the same behavior as ActiveSupport::Tryable#try. Usually try's receiver is an optional value, so these interface should be the same.

@pocke pocke merged commit 73137fe into ruby:main Jul 14, 2022
@pocke pocke deleted the _activesupport__More_accurate_type_for__try branch July 14, 2022 05:14
ksss added a commit to ksss/gem_rbs_collection that referenced this pull request Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant