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

Handle endless ranges #137

Closed
wants to merge 1 commit into from
Closed

Handle endless ranges #137

wants to merge 1 commit into from

Conversation

palkan
Copy link
Contributor

@palkan palkan commented Jan 4, 2020

Ruby version: 2.6.3
Unparser: 0.4.5
Parser: 2.6.3

This patch fixes the following error:

Unparser.unparse(Parser::CurrentRuby.parse("r = (1..)"))
#=> NoMethodError: undefined method `type' for nil:NilClass

Couldn't find a quick way to add tests for this change 🤷🏻‍♂️ (has been used and tests here).

@mbj
Copy link
Owner

mbj commented Jan 4, 2020

@palkan Thanks.

I'm surprised this is not found when round tripping rubyspec (which is part of the CI). I need to expand the corpus to catch these.

I'll add the tests in a fresh PR.

@mbj
Copy link
Owner

mbj commented Jan 4, 2020

@palkan any idea on a project that covers more ruby syntax?

The alternative idea was to hook the parser tests and roundtrip its tests. that is probably the gold standard.

@palkan
Copy link
Contributor Author

palkan commented Jan 4, 2020

I'm surprised this is not found when round tripping rubyspec

I found that rubyspec is far from complete) I had to write my own tests for this syntax.

any idea on a project that covers more ruby syntax?

Probably, some other transformers/analyzers, e.g., RuboCop. Though it mostly uses eval.
Ruby's own test suite also relies on eval.

Rails covers a lot but it's huge 🙂

@mbj
Copy link
Owner

mbj commented Jan 4, 2020

Rails covers a lot but it's huge

Unparser is quite fast (in sense of enough). So its probably a good corpus target. Intercepting the ruby fragments parser uses during may also be an option.

@mbj
Copy link
Owner

mbj commented Jan 4, 2020

I'm closing this in favor of #139

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

Successfully merging this pull request may close these issues.

None yet

2 participants