`@gc` is no longer part of the language: a developer never writes or mentions
it. GC-ness is decided entirely by inference (structural cycles + demand
promotion), which the earlier 7b commits made complete and precise.
- parser: `@gc` on a class is now WO-E104 ("GC-ness is inferred; run
`woc --dump-gc`. Remove it."). `is_gc` stays false; the class classifies by
inference. No `.wo` in the repo carries `@gc` anymore.
- types.ml: retired the WO-W201 machinery (suggest_gc_annotation,
has_recursive_structure(_type), has_unique_field, gc_suggestion_code) — it
suggested `@gc`, now obsolete since inference traces exactly those classes.
- runner.ml: deleted the 8 WO-W201 gc-suggestion test blocks; the @gc-exemption
test's `Cache` is made self-referential so inference classifies it gc without
an annotation.
- fixtures: dropped `@gc` from rc.wo (Cache demand-promotes via its escape),
elision.wo (Cache given a self-ref to stay structurally gc for the rc-elision
dump), pricing-demo.wo (PriceCache doesn't escape -> now owned), and the
abandoned-cycle/budget-steps corpus (Node is structurally gc). rc.wo keeps a
placeholder comment line so its line-indexed rc assertions hold. Goldens
re-blessed.
- docs: error catalog gains WO-E104 and marks WO-W201 retired; gc-cycle README
records the keyword removal.
Verified: woc-test 553/0 (was 566 minus the 13 retired WO-W201 checks),
test_diag 14/0, oop-e2e 79/0, employee 8/0, log-watcher 7/0. `git grep '@gc'`
finds only comments — success criterion 1 met.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
24 lines
787 B
Text
24 lines
787 B
Text
1:1 INTERFACE Priced
|
|
2:3 METHOD current_price() -> Int
|
|
6:1 CLASS Product @table(name="products", index=[sku])
|
|
7:3 FIELD id: Id
|
|
8:3 FIELD sku: Text @unique
|
|
9:3 FIELD name: Text
|
|
10:3 FIELD prices: multi Price
|
|
11:3 FIELD owner: ref Customer
|
|
13:3 METHOD current_price() -> Int
|
|
14:5 RETURN latest(self.prices).amount
|
|
17:3 METHOD rename(name: Text)
|
|
18:5 ASSIGN self.name = name
|
|
21:3 METHOD set_price(mut amount: Int)
|
|
22:5 ASSIGN self.prices = amount
|
|
25:3 METHOD adopt(take other: Product) -> Product
|
|
26:5 RETURN other
|
|
30:1 CLASS PriceCache
|
|
31:3 FIELD entries: map<Text, Int>
|
|
34:1 TYPE Note
|
|
35:3 FIELD id: Id
|
|
36:3 FIELD body: Text
|
|
37:3 FIELD created: Timestamp = now()
|
|
40:1 METHOD discount(mut amount: Int, take pct: Int) -> Int
|
|
41:3 RETURN amount
|