-
Notifications
You must be signed in to change notification settings - Fork 7
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
Migrate parsing to YARP #227
Conversation
spec.add_dependency("sorbet-runtime", ">= 0.5.9204") | ||
spec.add_dependency("unparser", ">= 0.5.6") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since YARP releases may contain breaking changes while still under develpment, should be put an upper limit on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may help us find and fix these bugs faster
begin_line: yarp_location.start_line, | ||
end_line: yarp_location.end_line, | ||
begin_column: yarp_location.start_column, | ||
end_column: yarp_location.end_column + 1, # TODO: Why is this off by one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Known issue, I'm verifying Kevin's suggestion for a fix here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! I'm going to merge and update this once fixed 👍
I bumped YARP to 0.0.10 and tested the changes on core 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't read through every line of the lib/rbi/parser.rb
changes, but I'm trusting the tests are sufficiently covering it.
test/rbi/parser_test.rb
Outdated
assert_equal("unexpected token $end", e.message) | ||
assert_equal("test_parse_real_file_with_error.rbi:2:0-2:0", e.location.to_s) | ||
assert_equal("Expected to be able to parse an expression. Expected `end` to close `class` statement.", e.message) | ||
# assert_equal("test_parse_real_file_with_error.rbi:1:10-1:10", e.location.to_s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be reinstated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah good idea. I commented it until we figure the weird locations returned by YARP but I can keep the wrong location in the assert instead
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
I've been experimenting with different parser backends to benchmark RBI parsing.
Here are the time required to parse all the 11801 RBI files in on big project:
This PR migrates RBI parsing to YARP and removes the dependecy to Whitequark and
unparser
.Running
tapioca check-shims
before (usingparser
gem):Running
tapioca check-shims
after (using YARP):