Repository navigation
fix(emit): an identity inside a composite is refused for the part - #372
Merged
Merged
Conversation
The structural renderer walks a composite's parts and renders each one
through c_render_of, which has no refusal of its own. So `print [ch]`
printed the channel's address, and `print [f]` reached cc. A struct field
or an enum payload did the same.
c_display_check now walks the parts the renderer would reach
(c_identity_part over c_render_parts) and refuses under E4076, naming the
part and the whole. It stops where c_render_runs stops: a type that
declares its own rendering answers for what it holds. (#368)
One case per container the walk descends through: a list, a tuple holding
a list, a map value, a struct field and an enum payload. Each kind of
identity and each rendering spelling is covered. The sentence names both
the part and the whole. All five were accepted, or reached cc, before the
fix.
format.md (en and zh-TW) says a composite that holds a channel or a function
value is E4076 at any depth, and that a type declaring its own `display`
answers for what it holds.
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 #368.
What
A channel or a function value inside a composite is now refused by every rendering spelling, under
E4076. Thatcovers
print,str(…), an f-string hole,.display()and.debug(), at any depth. The refusal names the part andthe whole:
Before this,
print [ch],(1, ch),{"a": ch}, a struct field and an enum payload printed the channel's address.print [f]reached cc (operand of type 'zg_fnptr').How
c_display_checkalready refused a bare identity. It now also walks the parts the structural renderer would reach,using
c_identity_partoverc_render_parts. That keeps a singleE4076report site. The walk stops wherec_render_runsstops: a type that declares its owndisplayanswers for what it holds, so a channel behind one stillrenders.
Tests
fn,str(…)), a map value (f-string), a structfield (
.display()) and an enum payload. All five were RED on the compiler without the fix (four accepted, onereaching cc).
codegen/identity_behind_overridechecks thatlist[W], a tuple and a map holding a type with its owndisplaystill render. The seed cannot print alist[W], so the case is an oracle skip.leaks --atExitis clean.reject,lint,refuse,error-codes-check,docs-mirror,docs-links,fixpoint,oracle,corpus,sanitize-corpus.Not here
The stale "a list has no rendering" comments are #371.
🤖 Generated with Claude Code
https://claude.ai/code/session_01N8jd1oK2orM6diHxhvWhC7