Skip to content

examples: restore the spec spellings #1308 parked behind now-fixed compiler defects - #1338

Merged
ehartford merged 5 commits into
mainfrom
examples-spec-spellings
Sep 22, 2026
Merged

ehartford merged 5 commits into
mainfrom
examples-spec-spellings

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

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.

Site Defect Outcome
examples/ephemerality-and-lowering/test/ephemerality_and_lowering_test.w (the "#1287" comment; the brief listed it as async-auction.w) #1287, fixed in #1311 Restored: defer_order_third.store(order[2], .SeqCst), and the same for order[3].
examples/json-parser/json.w byte arms #1295, fixed in #1312 Restored: Some(b'{') => ... byte-literal patterns in next_token and read_string. The - / digit arm keeps its guard because is_digit is a real predicate.
examples/json-parser/json.w kv_value helper #1297, fixed in #1327 (merged) Restored: for entry in entries: if entry.key == key: return Some(&entry.value). The helper is deleted.
examples/nebula/src/schema.w #1288 and #1289, fixed in #1311 Restored: @[derive(Debug, Clone)] on Status and on Telemetry.
examples/service/src/service.w describe_changes #1298, fixed in #1319 Restored the §7.2 builder: let changes = with Vec.new() as mut changes: with trailing ifs.
examples/service/src/repo/postgres.w update (a second #1298 site the brief did not list) #1298, fixed in #1319 Restored: let sets = with Vec.new() as mut parts:.
examples/ecs/src/storage.w DenseStorage.insert cited #1296, but it is not a workaround Kept -> Unit; the comment now cites D43. The tail if has an assignment arm (self.dense_data[idx] = component, which has type T) 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 .tbd files break lld 22). I ran the lane's steps (build/examples.w) on origin/main's examples/ and on this branch with that compiler: json.w built and run, the ecs, nebula and service packages 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_changes and update are not reached by the demo, so I ran the same builder-with-trailing-if shape separately under run --debug-alloc: the result was correct and it reported zero leaks. With the annotation deleted, ECS insert still checks ok (#1337).

Other comments under examples/ that name an issue or say "until" / "workaround" (not changed here):

Eric Hartford added 5 commits September 22, 2026 15:51
…e(order[2], ...) (#1287 fixed in #1311)

The typed-binding detour around #1287 (Atomic intrinsics passed an element view's address as the value) is gone with its comment. Package test output unchanged on a release compiler built from ae609cd.
…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.
… again (§11.8; #1288, #1289 fixed in #1311)

The parking comment is 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.
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery on 3a77ca8c (seed-driven): build, :fixpoint rc=0; :test red only in main's known reds — behav_distinct_compat (#1339) and the three #1325 regressions (#1340). examples-tests is green with every example in spec form. Marking ready.

@ehartford
ehartford marked this pull request as ready for review September 22, 2026 20:18
@ehartford
ehartford merged commit 827e653 into main Sep 22, 2026
@ehartford
ehartford deleted the examples-spec-spellings branch September 24, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant