writeonce/tests/corpus/trap/pricing-set-price-db-stub/fixture.wo
shoney.arickathil 79605cbb4f feat: milestone 1 complete — .wob emitter, conformance corpus, single binary; GC redesign specced
- `woc` now emits `.wob` that `wovm` runs: emit.ml lowers the typed,
  owner-annotated AST (scope-stack registers with a >64 WO-E401 diagnostic,
  Lua-style call windows, ICALL by slot, dedup const pool, drop maps, line
  tables, implicit terminators); disasm.ml backs `--dump-bc` goldens.
- Ownership lowering consumes the four owner tables verbatim; RESIDUAL is the
  only source of borrow ops, coalesced per operand. Review caught the emitter
  consuming only 2 of owner.ml's 4 residual producers — an assignment-anchored
  aliasing violation ran to exit 0 instead of trapping; fixed, plus a backstop
  raising WO-E404 for any residual region left unconsumed.
- Conformance harness `scripts/oop-e2e.sh` (`just oop-e2e`): four fixture
  kinds with exact outcomes — byte-exact stdout, one WO-E### anchored on
  `error CODE:`, numeric trap code, gc trace. 25 fixtures incl. pricing-demo
  logic, the ownership suite, and DB_STUB's parse-but-trap. `tests/` un-ignored
  so the corpus is actually tracked.
- `woc build` produces a self-contained binary: wovm copy + appended image +
  20-byte trailer, self-exec via /proc/self/exe. Verified relocated outside
  the repo, argless, and against adversarial trailer corruption.
- Milestone 1's five spec criteria all MET (`just oop-accept`). Criterion 3
  closed by WO-E405 — the entry must return `Int`, since program mode already
  says its return value is the exit code — which deletes the leak class
  without adding return-type metadata to the format. `gc/held-cycle` retired:
  an externally-held cycle is not expressible in a post-exit pump.
- New spec: inferred GC + incremental per-shard tri-color mark-sweep, retiring
  `@gc` and reference counting. Story gains iterations 7b (that work) and 9b
  (`@table`, relations, compiler-checked query); `.dev/reference` gains a
  sparse System.Linq checkout. Priority: 5→6→7 (log-watcher) then 7b, 8, 9, 9b.
2026-08-11 19:31:26 +02:00

29 lines
1.1 KiB
Text

-- Pricing-demo corpus (plan 3, Task 3): mirrors
-- docs/examples/pricing/types/product.wo's `set_price` -- the write path
-- whose `insert Price { ... }` is the SQL sublanguage's one opaque node
-- (compiler/src/parser.ml's `insert`/`select` "parses but traps"
-- contract) and lowers to a single DB_STUB opcode (docs/plan/oop-vm/
-- 00-wob-format.md), which traps WO_T_DB unconditionally ("engine not
-- linked") -- the spec's parse-but-trap story, proven end to end.
-- Trimmed for milestone-1 grammar: `in txn`, `assert ... otherwise
-- abort` (no assert/otherwise/abort keywords in this grammar), and the
-- `service rest` block -- only the `insert` statement `set_price`
-- actually needs to prove the trap is kept. `self.id` became plain
-- `self` since the `id` field itself was trimmed; it doesn't matter to
-- the trap -- `insert`'s body is never re-parsed, only captured verbatim.
class Price {
amount: Int
}
class Product {
prices: multi Price
fn set_price(amount: Int) {
insert Price { product: self, amount: amount }
}
}
fn main() {
let prod = Product { prices: multi_new() }
prod.set_price(4999)
}