writeonce/compiler/test/golden/bc/elision.expected
shoney.arickathil 2379a95016 feat(compiler): remove @gc from the language — GC-ness is fully inferred (7b)
`@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>
2026-08-18 19:19:09 +02:00

53 lines
1.2 KiB
Text

== CONSTANTS ==
k0 TEXT "Cache"
k1 TEXT "Holder"
k2 TEXT "hits"
k3 TEXT "peer"
k4 TEXT "cache"
k5 TEXT "read"
k6 TEXT "proven"
k7 TEXT "main"
k8 INT 41
k9 INT 1
== CLASSES ==
c0 Cache flags=gc fields=[hits:SCALAR, peer:GCREF]
c1 Holder flags=- fields=[cache:GCREF]
== INTERFACES ==
== VTABLES ==
== METHODS ==
m0 read args=1 regs=2 [free fn]
lines: 0->20
drops: (none)
0000 GETF r1, r0, f0
0001 RET r1
m1 proven args=1 regs=3 [free fn]
lines: 0->24 1->25
drops: pc 1 owned={} gc={r1}
0000 GETF r1, r0, f0
0001 MOVE r2, r1
0002 CALL r2, m0
0003 RET r2
m2 main args=0 regs=6 [free fn] [ENTRY]
lines: 0->29 3->30 7->31 13->28
drops: pc 3 owned={} gc={r0}
drops: pc 7 owned={r1} gc={r0}
drops: pc 14 owned={} gc={r0}
drops: pc 15 owned={} gc={}
0000 NEW r0, c0
0001 LOADK r1, k8
0002 SETF r0, f0, r1
0003 NEW r1, c1
0004 MOVE r2, r0
0005 RC_INC r2
0006 SETF r1, f0, r2
0007 MOVE r4, r1
0008 CALL r4, m1
0009 MOVE r3, r4
0010 LOADK r5, k9
0011 ADD r2, r3, r5
0012 BUILTIN r2, r2, print_int
0013 DROP r1
0014 RC_DEC r0
0015 RET0
== ENTRY ==
m2