Commit 00d34ad
fix: exhaustive Statement match for concurrency variants (restores build) (#56)
## Problem
The `Statement` enum in `src/ast/mod.rs` gained worker/concurrency
variants
(`WorkerSpawn`, `SendMessage`, `ReceiveMessage`, `AwaitWorker`,
`CancelWorker`) but several `match stmt` sites were never updated. This
produced `error[E0004]` non-exhaustive match and broke `cargo build`
(the `woke` binary failed to compile; `cargo build --lib` exited 101).
## Sites fixed
Four match sites were missing the new variants:
1. **`src/ast/visitor.rs` — `walk_statement`** (missing `SendMessage`,
`ReceiveMessage`, `AwaitWorker`, `CancelWorker`):
`SendMessage` now recurses into its `message` expression, exactly like
the neighbouring expr-bearing arms (`Expression`, `Assignment`, …). The
three name-only variants are leaves, so they join the existing leaf arm
alongside `WorkerSpawn`/`Complain`/`Break`/`Continue`.
2. **`src/interpreter/mod.rs` — `execute_statement`** (missing
`SendMessage`, `ReceiveMessage`, `AwaitWorker`, `CancelWorker`;
`WorkerSpawn` was already handled):
There is no worker-name-addressed messaging runtime — `WorkerSpawn`'s
own inline comment states workers communicate via channels created in
the main scope, and workers run detached. Rather than fake a no-op,
each of the four variants returns a clear, actionable `RuntimeError`
(built with `RuntimeError::new`, consistent with the `Complain` arm and
the break/continue-outside-loop guards), pointing the user at the
channel-based pattern.
3. **`src/sexpr.rs` — `stmt_to_sexpr` and `stmt_to_json`** (both missing
all four variants): real serialization added for each, matching the
style of neighbouring arms (`(send :to "..." <expr>)`,
`(receive :from "...")`, `(await-worker "...")`,
`(cancel-worker "...")`; and the equivalent JSON objects).
No silent `_ => {}` catch-all was introduced anywhere, so any future
`Statement` variant will continue to surface as a compile-time error.
## Build verification
```
$ cargo build --lib
warning: `wokelang` (lib) generated 14 warnings
Finished `dev` profile [unoptimized + debuginfo] target(s)
$ cargo build
warning: `wokelang` (bin "woke-dap") generated 1 warning
Finished `dev` profile [unoptimized + debuginfo] target(s)
$ cargo test --no-run
Executable unittests src/bin/woke-lsp.rs (...)
Executable tests/codegen_test.rs (...)
Executable tests/e2e_full_pipeline_test.rs (...)
Executable tests/lsp_handler_test.rs (...)
Executable tests/lsp_integration_test.rs (...)
Executable tests/property_test.rs (...)
```
All three complete with no errors (pre-existing warnings only).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: hyperpolymath <hyperpolymath@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent 4655f3b commit 00d34ad
3 files changed
Lines changed: 59 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
515 | 515 | | |
516 | 516 | | |
517 | 517 | | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
518 | 542 | | |
519 | 543 | | |
520 | 544 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
334 | 348 | | |
335 | 349 | | |
336 | 350 | | |
| |||
710 | 724 | | |
711 | 725 | | |
712 | 726 | | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
713 | 744 | | |
714 | 745 | | |
715 | 746 | | |
| |||
0 commit comments