Commit 5e378f2
committed
Convert character offset to byte offset in parse_inline_*_annotation
Parser.parse_inline_leading_annotation and parse_inline_trailing_annotation
were passing character offsets directly to the C parser, which expects byte
offsets since #2863. With ASCII-only input the two coincide so the bug was
hidden, but multibyte content (e.g. a Japanese comment preceding the
annotation) caused the C parser to start at an invalid byte position and
emit a parsing error.
Apply the existing byte_range helper to convert character offsets to byte
offsets, matching the pattern used by parse_type, parse_method_type, and
other parse_* methods.
The existing tests for parse_inline_*_annotation used ASCII-only input
which would not catch this class of bug, so multibyte regression tests are
added.1 parent 4c6a3a9 commit 5e378f2
2 files changed
Lines changed: 37 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
129 | | - | |
| 130 | + | |
| 131 | + | |
130 | 132 | | |
131 | 133 | | |
132 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
559 | 559 | | |
560 | 560 | | |
561 | 561 | | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
562 | 595 | | |
0 commit comments