Skip to content

Conversation

@Earlopain
Copy link
Collaborator

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
Collaborator 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