refactor(language): each named expression is resolved once, and every use reads that node - #632
Merged
FBumann merged 1 commit intoSep 23, 2026
Conversation
Documentation build overview
15 files changed ·
|
FBumann
added this pull request to stack #637
September 22, 2026 20:48
FBumann
force-pushed
the
claude/blissful-heisenberg-z5rpwo-named
branch
from
September 23, 2026 08:16
764f53e to
968f1f9
Compare
… use reads that node Namespace.named resolves an expressions: entry the first time anything reads it. Expansion inlines that node, and the resolver passes it through. Expansion no longer parses named expressions, the resolver no longer re-reads a cased expression's arms, and validation drops its deduplication of repeated arm errors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017XwKgY5wZXv1bKgkfCW2q1
FBumann
force-pushed
the
claude/blissful-heisenberg-z5rpwo-named
branch
from
September 23, 2026 11:25
968f1f9 to
8ca80c2
Compare
FBumann
removed this pull request from stack #637
September 23, 2026 11:30
FBumann
added this pull request to stack #644
September 23, 2026 11:32
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.
Note
The following content was generated by AI.
Namespace.namedresolves eachexpressions:entry once. Every use then reads that node: expansion inlines it, and the resolver passes it through. Before, every use parsed, expanded and resolved the entry again. Stacked on #631.Warning
Found in review, fixed at #643: a fault in a macro or an entry hides every other fault in the file (the early raise below); a cycle closed through a macro reports
a -> awithout the macro; a chain of 120 entries declared deepest first is aRecursionError. Fixed at #638 and pinned at #643: a piecewise link through a refused entry said "Its refusal is listed with it" and nothing listed it. Pinned at #643: a cycle through a case'swhen, aRecursionErroron the base branch, is refused here.Method, gate output, alternatives
What this changes
Namespace.named/named_entry. The first read resolves an entry under its own context and stores the node and its refusals. The expression cycle check moves here. The macro cycle check stays in expansion._named, moved from validation with_constant_arm._valueis the "stands for a value" parse, which_check_expressiondid for named entries before.Namespace, not theSpec._parse_named,_parse_casedand_parse_bodyare gone, and so is thepyrefly: ignorefor the unresolvedCaseArm.when.CasesNodeor aDefinitionNodethrough unchanged._Resolver._casesis gone._once: an arm error now has only one source. Validation raises after theexpressions:entries if any fails. fix(language): a long chain of named expressions loads, a typo beside a formal is refused, and a fault in an entry hides no other #643 removes that raise: the memo already reports an arm's fault once, so nothing needs the other declarations held back.Behaviour a user sees
named expression 'b' does not load. Its refusal is listed with it.. Before, it got the entry's fault again under its own context.expressions:faults (and any macro fault). At fix(language): a long chain of named expressions loads, a typo beside a formal is refused, and a fault in an entry hides no other #643 every declaration's fault is listed together.Tests
test_a_named_expression_is_resolved_once_however_many_usesandtest_a_use_of_a_refused_named_expression_names_it_rather_than_repeating_its_faultfail on the base branch and pass here.a-cyclefails with aRecursionError.test_a_fault_in_an_arm_names_the_declaration_and_is_reported_oncefails.test_a_call_expands_to_core_astnow compares resolved trees, because an inlined body arrives resolved.Gates
pixi run lint: green.pixi run test: 1562 passed.docs-buildandcompile-texdid not run: the session proxy blocks their downloads.Where this departs from the house rule
src/grows by 8 lines net (171 added, 163 removed), because the memo is new code. The number of concepts goes down:_once, three expansion parsers,_Resolver._casesand the expression stack in expansion are removed, and one memo is added. AGENTS.md says a cleanup ends in fewer lines and fewer concepts, so this PR does not meet the lines half of that rule.🤖 Generated with Claude Code
https://claude.ai/code/session_017XwKgY5wZXv1bKgkfCW2q1
Generated by Claude Code