Restore RBS::Environment#declarations for backwards-compatibility #2393
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
RBS::Environment#declarations was removed recently in favor of a more flexible interface in RBS::Environment#declarations
I'd like to restore RBS::Environment#declarations as a simplified consumer of RBS::Environment#declarations so that current users of the rbs gem are not broken by this change.
In particular, the situation I am facing:
Solargraph is a user of the rbs gem to pull in RBS types to work alongside YARD-style types.
Solargraph is striving to maintain compatibility with Ruby 3.0, and thus we'd like to support older versions of the rbs gem, given the requirement of Ruby 3.1 for the current rbs gem.
Solargraph uses RBS::Environment#declarations - the code which uses RBS::Environment#declarations is here: https://github.com/castwide/solargraph/blob/master/lib/solargraph/rbs_map/conversions.rb
Would you accept this small shim to maintain compatibility, or perhaps advise on how we can prepare for the new version by switching to a more stable API? I'm not sure if you intended this function to be used from the outside world.
BTW, very excited to see the current work landing--looks very interesting for everyone 🎉