Semantic Diff

#9161 Represent %todo with a Pexp_todo parsetree node

1 commit

0c2890fb3ef0de4c2eee76026e5f4188487e28b7..pr-9161

3c9601031 · cknitt + Claude · Nov 01, 2026, 08:23 UTC

Represent %todo with a Pexp_todo parsetree node

Why

%todo is a language feature selected by an extension name, one of the items #8624 lists before the parsetree can be stamped as v1. The node holds the message as written; PPXs still see the extension.

modifiedAST %todo

let f = () => %todo("later")
parse
Before
After
expressionexpression└─ Pexp_extension "todo"   └─ structure_item      ├─ Pstr_eval      └─ expression         └─ Pexp_constant PConst_string (source="later", semantic="later")├─ Pexp_todo└─ Some   └─ expression      └─ Pexp_constant PConst_string (source="later", semantic="later")

Review

  • Which payloads become a node? None, a string literal, or a template without interpolations, without attributes. Any other payload, such as %todo(1), stays an extension and is lowered as before, ignoring it.
  • Why an expression for the message rather than a string? It keeps the spelling (quotes or backquotes, escapes) and the comments inside the payload for the printer, as the extension did.