join-conditional-element-write-through.ts 936 B

1234567891011121314
  1. // A conditional PLACE as an element of a join's array literal. The join element's
  2. // may-alias target is the ternary's canonical place node, whose OWN may-alias targets are
  3. // the two boxes, so a write through the destructured element has to chain through both
  4. // levels to reach box1.f / box2.f. Guards the write-through path across the two node kinds
  5. // this fix made persistent (join results and conditional places) at once.
  6. // Expected: ask#1 -> ask#2 data inexact (via box1.f / box2.f) — the assertion this fixture
  7. // exists for; ask#1 -> join#1 port=0 inexact (the written field is part of the joined
  8. // element, a may-write); ask#2 -> sink.
  9. const box1: { f: string } = { f: "" };
  10. const box2: { f: string } = { f: "" };
  11. const flag = Math.random() > 0.5;
  12. const [el] = await Promise.all([flag ? box1 : box2]);
  13. el.f = await agent("writer").ask<string>("secret");
  14. return agent("reader").ask<string>(`use ${box1.f} and ${box2.f}`);