async-promise-executor-reject-param.ts 714 B

123456789101112
  1. // Executor reject param: `new Promise((_, reject) => reject(secret))`. The generic
  2. // keystone-for-`new` rule captures whatever a function arg feeds to invocations of its OWN
  3. // params, for EVERY param — so the reject param (index 1) is covered like resolve (index 0).
  4. // Awaiting a rejected promise throws, so putting reject's arg into the resolved-value pot is a
  5. // deliberate over-approximation of the rejection path (sound: an added may-flow, never a drop).
  6. // Expected: ask#1 -> ask#2 data; ask#2 -> sink.
  7. const secret = agent("scanner").ask<string>("scan");
  8. const p = new Promise<string>((_resolve, reject) => {
  9. reject(secret);
  10. });
  11. const v = await p;
  12. return agent("writer").ask<string>(`report: ${v}`);