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 an incompatibility with the parser translator #3338

Merged
merged 1 commit into from
Dec 21, 2024

Conversation

Earlopain
Copy link
Contributor

For rubocop/rubocop#12982

The offset cache contains an entry for each byte so it can't be accessed via the string length. For the bytesize is 3, so it's two bytes off. Adds tests for all variants except for this:

"fo
o" "ba
’"

For some reason, this still has the wrong offset. Also, one test fails in RubyParser but that is certainly out of my area of expertise.

The offset cache contains an entry for each byte so it can't be accessed via the string length.

Adds tests for all variants except for this:
```
"fo
o" "ba
’"
```

For some reason, this still has the wrong offset.
@Earlopain Earlopain force-pushed the parser-translator-offset-cache branch from 72909b4 to a651126 Compare December 21, 2024 21:01
@kddnewton kddnewton merged commit 79873f2 into ruby:main Dec 21, 2024
54 of 55 checks passed
@Earlopain
Copy link
Contributor Author

Actually, I think the reason why that other test I wanted to add doesn't work is for the same reason as #2539 (comment)

In isolation the test works but when there is more than one multi-byte character it breaks. The offset is not correct when there were previous multibyte characters in the file.

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.

2 participants