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

Fix parser to accept alias names starting with _ #723

Merged

Conversation

pocke
Copy link
Member

@pocke pocke commented Jul 22, 2021

Fix #722

I've confirmed other tINTERFACEIDENT usage, for var_name_opt, simple_name, andinterface_name are valid.
var_name_opt has been fixed by #721.
simple_name is used by qualified_name, and it doesn't need to accept underscored name. For example, Foo::_bar is invalid always.
inteface_name is just tINTERFACEIDENT, so it doesn't need to accept tUNDERSCOREIDENT.

Now exe/rbs parse ../gem_rbs_collection/gems/**/*.rbs prints no error 🎉

@pocke pocke force-pushed the Fix_parser_to_accept_alias_names_starting_with____ branch from 50bb033 to 5e4dceb Compare July 22, 2021 08:48
Comment on lines +1780 to +1786
def test_underscore_qualified_name
assert_raises RBS::Parser::SyntaxError do
Parser.parse_signature(<<-RBS)
type x = Foo::_bar
RBS
end
end
Copy link
Member Author

Choose a reason for hiding this comment

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

This PR doesn't affect qualified_name, but I added the test for qualifed_name to clear that it doesn't accept tUNDERSCOREIDENT.

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 merged commit a00fd9b into ruby:master Jul 22, 2021
@pocke pocke deleted the Fix_parser_to_accept_alias_names_starting_with____ branch July 22, 2021 13:55
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.

Regression in 1.3.1 with parameters that start with _ no longer valid
2 participants