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

How to find missing methods? #222

Open
connorshea opened this issue Mar 14, 2020 · 3 comments · May be fixed by #235
Open

How to find missing methods? #222

connorshea opened this issue Mar 14, 2020 · 3 comments · May be fixed by #235

Comments

@connorshea
Copy link
Contributor

For example, Range is currently missing the minmax method that was added in Ruby 2.7.

https://github.com/ruby/ruby-signature/blob/117a94a55380a2bfa04f3f383822dfc563a4312d/stdlib/builtin/range.rbs

Is there any way to find methods that aren't represented in the ruby-signature type library, and if not should we create some way of doing that? Having a way of tracking 'type coverage' for the Ruby core and stdlib classes would probably be pretty useful.

@ghost
Copy link

ghost commented Mar 20, 2020

I think rbs prototype runtime --merge CLASS.
Please see https://github.com/ruby/ruby-signature/blob/master/docs/CONTRIBUTING.md#steps-for-contribution in No.4

@connorshea
Copy link
Contributor Author

connorshea commented Mar 21, 2020

I wrote a script to find methods and aliases that are missing from an RBS by using the runtime prototyper:

ruby-signature connorshea$ bundle exec bin/find_missing --patterns=Module stdlib/builtin/module.rbs
Opening stdlib/builtin/module.rbs...
Missing methods:
- const_source_location
- deprecate_constant
- pretty_print
- pretty_print_cycle
- undef_method
- initialize_clone
- initialize_copy
- method_undefined
- ruby2_keywords

Missing aliases:
- alias inspect to_s

It's pretty hacky, and there are methods that shouldn't be in here like pretty_print (that's mixed in, idk how to filter those out), but it works pretty well.

@connorshea
Copy link
Contributor Author

I think rbs prototype runtime --merge CLASS.
Please see https://github.com/ruby/ruby-signature/blob/master/docs/CONTRIBUTING.md#steps-for-contribution in No.4

That's almost what I want, but it adds a lot of extra stuff to the RBS file that gets output, and I just want to know what the RBS file is missing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant