Dedup: extract shared _all_elim_str helper for AllElim/AllElimTypes (refs #813) - #1147
Open
jsiek wants to merge 1 commit into
Open
Dedup: extract shared _all_elim_str helper for AllElim/AllElimTypes (refs #813)#1147jsiek wants to merge 1 commit into
jsiek wants to merge 1 commit into
Conversation
…refs #813) AllElim.__str__ and AllElimTypes.__str__ were byte-for-byte identical except for the bracket glyphs ([ ] vs < >). Fold the shared logic into a module-level _all_elim_str(univ, arg, pos, open_b, close_b) helper next to _postfix_base_str, which both already call. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 28, 2026
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
Small duplication-reduction slice for the #813 umbrella.
AllElim.__str__andAllElimTypes.__str__inabstract_syntax/proofs.pywere byte-for-byte identical except for the two bracket glyphs —
[/]forterm arguments vs
</>for type arguments. Both already delegated theirbase-proof rendering to the module-level
_postfix_base_str.This PR folds the shared control flow into a new module-level helper next to
_postfix_base_str:so each
__str__becomes a one-line call:AllElimTypes.__str__→_all_elim_str(self.univ, self.arg, self.pos, "<", ">")AllElim.__str__→_all_elim_str(self.univ, self.arg, self.pos, "[", "]")No behavior change: the emitted string is identical for both cases.
Tests
Ran locally (green):
python3 test-deduce.py --equiv— RD/LALR AST equivalence and thepretty-print round-trip corpus, which exercises
AllElim/AllElimTypesprinting directly.
python3 test-deduce.py --passable— should-validate under both parsers.ruffandmypyare not installed in this container; CI's static-checks legcovers them. The change is a pure refactor with no signature changes to public
APIs.
Refs #813.
Resume this session on ginger:
~/deduce-runner/resume.sh 208dc587-9660-431b-b3f2-a9d904333886 routine/20260728-010202🤖 Generated with Claude Code