fix(_types): ParsedName repr names the token behind each ambiguity - #447
Merged
Conversation
Two distinct suffix-or-name ambiguities about different words rendered as identical ['suffix-or-name', 'suffix-or-name'] entries, reading as a double-emit bug rather than two separate calls. Follow Ambiguity.__repr__'s own token-join convention so each entry names its token(s), e.g. ['suffix-or-name: MA', 'suffix-or-name: V']. Fixes #431 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #447 +/- ##
=======================================
Coverage 98.61% 98.61%
=======================================
Files 45 45
Lines 3095 3095
=======================================
Hits 3052 3052
Misses 43 43 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ParsedName.__repr__rendered theambiguitiesline as[a.kind.value for a in self.ambiguities], so two distinctAmbiguityobjects of the same kind about different words collapsed into identical-looking entries (['suffix-or-name', 'suffix-or-name']), reading as a double-emit bug in the emitter rather than the two separate, correctly-distinct calls they are.Ambiguity.__repr__'s own token-join convention ("/".join(t.text for t in self.tokens)) so each entry names its token(s):['suffix-or-name: MA', 'suffix-or-name: V']. Falls back to barekind.valuewhen an ambiguity has no tokens (e.g.UNBALANCED_DELIMITER).Fixes #431
Test plan
tests/v2/test_reprs.py::test_parsedname_repr_includes_ambiguities_line_when_presentfor the new formattests/v2/test_reprs.py::test_parsedname_repr_distinguishes_same_kind_ambiguities_by_token, a regression test for the exact two-ambiguity case from the issueuv run pytest -q→ 5924 passed, 154 skipped, 9 xfailed🤖 Generated with Claude Code