Repository navigation
fix(emit): a list renders through str(…) and a hole, so assert xs == ys reports both sides - #363
Merged
Merged
Conversation
…print`
`str(xs)` and `f"{xs}"` over a list that is not bytes or code points
were refused as E4011, "a composite has no rendering of its own". It
has had one since the structural rendering was built, and `print xs`
and `xs.display()` used it; only the `str(…)` arm still turned a list
away, before it reached the renderer every other composite takes.
The arm keeps its two bridges and hands every other list on. That is
what `assert xs == ys` was refused for: its message is an f-string
with a hole per operand, so the claim compared and could not be
reported.
E4011 retires: its rule, its table row (en and zh-TW) and its refuse
case go together.
Closes #359.
Bumps test-data for codegen/list_in_a_hole: the four spellings over
one list, the two bridges that stay text, and asserts over lists that
hold and that report both sides.
…made
A list a call answered is rendered and released, the text is the
caller's, and a held list is read afterwards; an assert over two
lists binds both sides. Shown red with the renderer's give-back
skipped for a list.
The split tests' header no longer cites the refusal that was their
reason for going through `join`.
package.md said a claim over two lists had to be parenthesized. It
is claimed like any other form now. format.md gains the one place
the four spellings differ: `str(…)` over bytes or code points is the
way back to text and not a rendering.
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 #359.
What
assert xs == ysover two lists builds, and a failing one reports both sides:The claim was never the problem. An assert's message is an f-string with a hole per operand, a hole lowers
through
str(…), andstr(…)refused any list that is not bytes or code points (E4011, "a composite has norendering of its own"). Every composite has rendered since the structural rendering was built —
print xsandxs.display()used it — and that arm was the one place still turning a list away. It now keeps its twobridges and hands every other list to the same renderer.
So this is wider than the issue's title:
str(xs)andf"{xs}"render a list as[1, 2], which is whatdocs/runtime/format.mdalready said all four spellings do.E4011retires.Decisions made here
assert. The issue offered a narrower way out (keep the refusal, rewordit for
assert). The chapter says a list renders through a hole, so the refusal was the deviation.str(bs)andf"{bs}"over alist[byte]orlist[rune]are still thetext, while
print bsshows[104, 105]. That difference predates this change;format.mdnow says so.Found on the way, not fixed
print [ch],f"{m}"for a map holding one, a tuple.Top level is
E4076. This is on main today throughprint; this change adds the list-in-a-hole spelling tothe ways of reaching it. Not filed yet.
c_renders_as_textstill answers "no" for a list that does not bridge, as it does for a map, so thexs.format("04d")refusal says there is no rendering to fall back on when there is one.Verified
mem-check oracle corpus sanitize-corpus mem-peak examples docs-mirror docs-links docs-zerg docs-refused
docs-repeat marker-codes chapter-codes deviation-check refusal-cites method-gaps gates treesitter dead-code
stdlib-test compiler-test check-equal reject-fuzz fmt-corpus behaviour conformance productions suites desugar.
refuseandmem-checkalso under/bin/bash.mem-checkcase was red with the renderer's give-back skipped for a list (2730 per round), greenafter.
guardcaught, the classassert_claimis already listedfor; it is listed beside it under the same
?. With the guarded asserts removed it reports no leak.Not verified
make testas one board was not run.make lspwas not run (zrt_listdirsorts by insertion: a large directory costs its square, andmake lspfails under a crowded$TMPDIR#361).🤖 Generated with Claude Code
https://claude.ai/code/session_01N8jd1oK2orM6diHxhvWhC7