Repository navigation
examples: restore the spec spellings #1308 parked behind now-fixed compiler defects - #1338
Merged
Merged
Conversation
added 5 commits
September 22, 2026 15:51
…entry.value inline (#1295, #1297 fixed) Byte arms are Some(b'{') patterns, not guards (#1295, fixed in #1312); json_get_field returns Some(&entry.value) from a for loop over the entries, and the kv_value helper is gone (#1297, fixed in #1327). Workaround comments removed. Demo and package test output unchanged on a release compiler built from ae609cd.
… builder (#1298 fixed in #1319) describe_changes and PgUserRepo.update spell with Vec.new() as mut ...: with a trailing if; the var desugaring and its comments are gone. Demo and package test output unchanged on a release compiler built from ae609cd (neither function is reached by the demo; the same shape was run separately under --debug-alloc: correct result, zero leaks).
insert's tail if has an assignment arm (a value of type T) and a push arm (Unit): two meanings remain, so -> Unit is the spelling D43 requires, not a workaround. The compiler currently infers Unit without it because the assignment arm is a multi-statement block (#1337); the one-statement spellings of the same arm are rejected as D43 requires.
Contributor
Author
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.
PR #1308 spelled several examples around compiler defects and marked each with a comment. Those defects are now fixed on main, so this PR puts back the spec spelling and deletes the workaround comments. It has one commit per example.
examples/ephemerality-and-lowering/test/ephemerality_and_lowering_test.w(the "#1287" comment; the brief listed it as async-auction.w)defer_order_third.store(order[2], .SeqCst), and the same fororder[3].examples/json-parser/json.wbyte armsSome(b'{') => ...byte-literal patterns innext_tokenandread_string. The-/ digit arm keeps its guard becauseis_digitis a real predicate.examples/json-parser/json.wkv_valuehelperfor entry in entries: if entry.key == key: return Some(&entry.value). The helper is deleted.examples/nebula/src/schema.w@[derive(Debug, Clone)]onStatusand onTelemetry.examples/service/src/service.wdescribe_changeslet changes = with Vec.new() as mut changes:with trailingifs.examples/service/src/repo/postgres.wupdate(a second #1298 site the brief did not list)let sets = with Vec.new() as mut parts:.examples/ecs/src/storage.wDenseStorage.insert-> Unit; the comment now cites D43. The tailifhas an assignment arm (self.dense_data[idx] = component, which has typeT) and a push arm (Unit). That gives two meanings, so D43 requires the annotation. The compiler currently accepts the function without the annotation, because the assignment arm is a block with more than one statement. The one-statement spellings of the same arm are rejected as D43 requires. That inconsistency is filed as #1337.Failing examples: none. Every restored spelling compiles, and no example is red.
Verification. I built a release compiler from
ae609cdd(SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX15.4.sdk; the Xcode MacOSX27.0 SDK's.tbdfiles break lld 22). I ran the lane's steps (build/examples.w) on origin/main'sexamples/and on this branch with that compiler:json.wbuilt and run, theecs,nebulaandservicepackages built and run, and the five package tests. Every step returned exit code 0, and all 9 outputs are byte-identical between the two trees.describe_changesandupdateare not reached by the demo, so I ran the same builder-with-trailing-ifshape separately underrun --debug-alloc: the result was correct and it reported zero leaks. With the annotation deleted, ECSinsertstill checksok(#1337).Other comments under examples/ that name an issue or say "until" / "workaround" (not changed here):
examples/service/src/errors.w:26,35: "Explicit conversion functions (From trait not yet available)". This is a stale pre-examples: rewritten to the current spec (D55 ruling 4) + examples-tests lane in the battery (#1150) #1308 comment. §10.9error X from A, Bexists and nebula uses it. The threeservice_error_from_*functions are never called. The spec has no form that combinesfromwith the type's own variants (Validation,TimedOut,Cancelled), so the rewrite needs a spec answer first.examples/nebula/README.md:65: "blocks until complete". This is prose, not a workaround.World.spawnspelledspawn_entity"until Diagnostic: a method named with the reserved wordspawnis reported at the call site ("only available inside scope") instead of at the declaration #1303". Diagnostic: a method named with the reserved wordspawnis reported at the call site ("only available inside scope") instead of at the declaration #1303 is open and now asks only for a better diagnostic, becausespawnis reserved. There is no comment in the code.