#5732: preserve compact | pipe when target formation floats away#5736
Draft
yegor256 wants to merge 1 commit into
Draft
#5732: preserve compact | pipe when target formation floats away#5736yegor256 wants to merge 1 commit into
| pipe when target formation floats away#5736yegor256 wants to merge 1 commit into
Conversation
Contributor
|
The printer emitted the `|` pipe-application form (#5684) only when the pipe target was the immediately-preceding sibling. When a pipe target formation floats up to become a formation attribute (#5526) while its pipe application stays nested inside another expression, the adjacency guard in `to-eo-tree.xsl` failed and the line printed as an ordinary application, destroying the compact author spelling on the first format. Add `renest-pipe-monikers.xsl`, a targeted pass mirroring `merge-monikers.xsl`, that relocates a floated pipe target formation back down to nest directly above its single pipe use-site, so the adjacency guard fires and the `|` is emitted. Gated on the formation having exactly one reference which must be the pipe use, matching the single-host convergence condition (#5706). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TipwHhMMamjeKKum4ggWLw
yegor256
force-pushed
the
claude/github-issue-5732-teanvx
branch
from
July 24, 2026 05:42
3c57765 to
62e1020
Compare
|
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.



Closes #5732.
Problem
After #5684 the printer emits the
|pipe-application form, but the adjacency guard atto-eo-tree.xsl:223only fires when the pipe target is the immediately-preceding sibling. When a pipe target formation floats up to become a formation attribute (#5526) while its pipe application stays nested inside another expression (the "floated away" case), the guard fails and the line prints as an ordinary application — destroying the compact| argsauthor spelling on the firsteo:format. This is exactly the recursive-helper case ineo-runtime/src/main/eo/tuple/front.eo.merge-monikers.xslalready un-hoists ordinary> namebindings back onto their use-site, but it deliberately skips pipe-floated bindings (not(exists($attr/@pipe))) and references carrying arguments (not($ref/o)) — which is precisely what a| argsuse is.Fix
Add
renest-pipe-monikers.xsl, a small targeted pass mirroringmerge-monikers.xsl, registered right after it in theXmirtrain (beforeto-eo-tree.xsl). For a formation attribute whose only reference is a single@pipeapplication that no longer sits directly after it, the pass copies the formation back in front of that pipe use-site and drops the floated original. The pipe then reads its predecessor from the immediately preceding sibling, so the existing adjacency guard fires and the|head is emitted. Both spellings parse to identical XMIR, so re-nesting is safe.It is gated on the formation having exactly one reference which must be the pipe use — the same single-host condition
merge-monikersuses (#5706) to keep the round trip converging. A second reference would fall out of scope once the formation moved into the pipe's argument block. A formation already adjacent to its pipe use is left untouched.Changes
renest-pipe-monikers.xsl— the new pass.Xmir.java— register the pass in the transformation train aftermerge-monikers.to-eo-tree.xsl— update the pipe-application comment to note the floated case is now re-nested upstream.pipe-floated-recursive-helper.yaml— new print-pack modeling thetuple/front.eorecursive helper; the|now survives the round trip.pipe-in-argument-block.yaml— updated expected output: the pipe is now preserved instead of degrading to a bare application.Testing
XmirTest(all 139 parameterized print-pack / eo-pack cases) passes, including the round-trip check that printed EO reprints to the very same EO.Generated by Claude Code