heap-aliasing-delete-survives.ts 388 B

1234567
  1. // `delete` is gen-only: no kill. On the non-deleting path box.f still carries
  2. // ask#1's output into the reader, so the edge must survive the maybe-delete.
  3. // Expected: ask#1 -> ask#2 data; ask#2 -> sink.
  4. const box: { f?: string } = {};
  5. box.f = await agent("writer").ask<string>("secret");
  6. if (Math.random() > 0.5) delete box.f;
  7. return agent("reader").ask<string>(`use ${box.f ?? ""}`);