rbs
rbs copied to clipboard
Add support for `alias $x $y`
(Originally a discussion, #1611, I think this is more apt as an issue).
One of the lesser-known facts of ruby is you can also use alias to alias global variables to one another, such as alias $LOAD_PATH $:.
I propose we support this syntax in RBS (it'd be useful for require 'English'). It's very, very niche, but should be supported eventually for completeness.
Shunt to the back of the backlog?
I understand we need it for completeness, but I don't think it's a priority because it's niche...
I'm not against implementing it if someone can send a PR. The outline would be:
- Add a syntax
AST::Declarations::GlobalAliasor something? - Implement parser
- Add a method to resolve type of global like
Environment#global_type: (Symbol) -> Types::t? - Need a validation to reject circular definition