Commit 08b979d
Record what the in-place merge requires, and a second empty-tokens case
Two documentation defects from the aliasing review, which otherwise
cleared the merge rewrite: ~1.1M instrumented parses with no assertion
firing, and byte-identical output against the pre-fix spelling over
8,036 names x 16 configs (all three name orders, middle_as_family,
both patronymic rules, custom delimiters, both locale packs, the
HumanName facade and the Constants shim) plus 120,375 names x 8
policies of targeted chain fuzz.
merge() now REQUIRES lo < hi, where the old spelling did not. Every
call site passes it, but with lo >= hi the slice assignment would
insert rather than replace, putting a second reference to pieces[lo]
into the array so the next merge extends the same list twice. Stated
at the call boundary rather than guarded: a silent no-op return would
hide a caller bug, and the constraint only matters to someone adding
a call site.
AmbiguityKind.UNBALANCED_DELIMITER called an empty token tuple a "rare
exception" for a character inside a masked region. Since content-free
input started keeping its diagnostics there is a second source, and it
covers the canonical example -- parse("(") reports with tokens=()
because no token survived. The docstring now admits both.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 0ae0b70 commit 08b979d
2 files changed
Lines changed: 14 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
132 | 139 | | |
133 | 140 | | |
134 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
262 | | - | |
263 | | - | |
264 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
265 | 269 | | |
266 | 270 | | |
267 | 271 | | |
| |||
0 commit comments