async-promise-join-in-ternary.ts 714 B

1234567891011
  1. // A join under a conditional PLACE: both arms are `Promise.all` calls, so the ternary
  2. // resolves as a place whose may-alias targets are the two join nodes. Divergence repro:
  3. // the pass-fresh join result was the alias target, so the ternary wrapper's set grew every
  4. // pass. Both node kinds are canonical now, so the union saturates.
  5. // Expected: each ask feeds its own join at port 0; the awaited element read reaches the
  6. // sink through BOTH joins (the ternary may be either) and through both asks (additive).
  7. const a = agent("a");
  8. const flag = Math.random() > 0.5;
  9. const pending = flag ? Promise.all([a.ask<string>("one")]) : Promise.all([a.ask<string>("two")]);
  10. const [got] = await pending;
  11. return `${got}`;