control-flow-switch-fallthrough.ts 363 B

1234567891011121314
  1. // switch fallthrough + default: taint reaches msg through every clause shape.
  2. const verdict = await agent("judge").ask<string>("verdict");
  3. let msg = "";
  4. switch (verdict.length) {
  5. case 0:
  6. msg = verdict;
  7. // fallthrough
  8. case 1:
  9. msg += " (short)";
  10. break;
  11. default:
  12. msg = `long: ${verdict}`;
  13. }
  14. return agent("act").ask<string>(`handle ${msg}`);