circular-ref.ts 631 B

123456789101112
  1. // Circular reference (divergence-crash fix): a self-referential object (`a.self = a`)
  2. // carrying real taint used to diverge the fixpoint into the iteration-cap throw. With
  3. // place-aliasing the self link is a single shared node, and cycle-aware, depth-bounded
  4. // merges keep the lattice finite, so the analysis converges and emits a graph. `a`
  5. // escapes to no sink here (the script returns a literal), so the only edge is the
  6. // completion-rule feed to the ask.
  7. // Expected: source -> ask#1 (no throw).
  8. const a: { self?: unknown; f?: string } = {};
  9. a.self = a;
  10. const s = await agent("w").ask<string>("x");
  11. a.f = s;
  12. return "ok";