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

[rbs/unit_test] Treat nil as a return value #2257

Merged
merged 9 commits into from
Jan 28, 2025
Merged

Conversation

ksss
Copy link
Collaborator

@ksss ksss commented Jan 26, 2025

On the Ruby side, when nil is returned, rbs/unit_test interprets it as a break, which revealed that the return value was not being checked.
I have fixed this issue and also fixed the tests that depended on this issue.

ksss added 8 commits January 25, 2025 23:57
`%a{implicitly-returns-nil}` cannot be checked to return `nil`
```
'\u{e4 f6 fc}'.encode('ISO-8859-1').to_sym.casecmp?(:'\u{c4 d6 dc}')
=> false
```
```
map.getkey(123)
=> nil
```
Since the return values of some methods have changed, we use gem to fix the behavior.
@ksss ksss changed the title Treat nil as a return value [rbs/unit_test] Treat nil as a return value Jan 27, 2025
@ksss
Copy link
Collaborator Author

ksss commented Jan 27, 2025

I made changes to RBS::Test::TypeCheck to account for %a{implicitly-returns-nil}.
Specifically, I updated it to allow annotations to be passed as arguments.

Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

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

Thanks! 🙏

@soutaro soutaro added this pull request to the merge queue Jan 28, 2025
@soutaro soutaro added this to the RBS 3.9 milestone Jan 28, 2025
Merged via the queue into ruby:master with commit 964066e Jan 28, 2025
19 checks passed
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.

2 participants