Repository navigation
Represent %todo with a Pexp_todo parsetree node - #9161
Conversation
Changelog🏠 Internal
Semantic Diff1 commit · Full page Represent %todo with a Pexp_todo parsetree node3c96010 · cknitt + Claude · Nov 01, 2026, 08:23 UTC
AST modified (%todo) let f = () => %todo("later")
expression
- 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
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## todo-stdlib-jserror #9161 +/- ##
=======================================================
- Coverage 81.67% 81.67% -0.01%
=======================================================
Files 455 456 +1
Lines 64859 64922 +63
=======================================================
+ Hits 52974 53024 +50
- Misses 11885 11898 +13
🚀 New features to boost your workflow:
|
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
AST modified (%todo):
Example:
let f = () => %todo("later")
Before (parse):
expression
Pexp_extension "todo"
[
structure_item
Pstr_eval
expression
Pexp_constant PConst_string (source="later", semantic="later")
]
After (parse):
expression
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.
Review: 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.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gJFAva9685fjvkajub
Signed-off-by: Christoph Knittel <ck@cca.io>
Why
%todois a language feature selected by an extension name, one of the items #8624 lists before the parsetree can be stamped as v1.What changes
%todoand%todo("message")parse to a new node:Ast_todo.of_payload). Any other payload, such as%todo(1)or%todo({"braced"}), stays aPexp_extension "todo"and is lowered as before.Ast_exp_extension.todo. The generated JS and warning 110 are unchanged.ast_mapper_to0writes the node as%todo(...), andast_mapper_from0turns a%todoextension with a fitting payload back into the node, the same way the parser does.depend,printastand editor completion handle the node likePexp_raw.Tests
tests/syntax_tests/data/ast-mapping/TodoExpressions.res: the v0 round trip.tests/syntax_tests/data/printer/expr/todo.res: printing, comments around and inside the payload, and parentheses in pipes, field access and unary minus.tests/syntax_tests/data/parsing/grammar/expressions/todo.res.todo_roundtrips_through_ast0inounit_ast_mapper0_tests.ml: which payloads become a node (none, a string, a template, but not1), the v0 wire shape, the exact tree (locations included) after a round trip, and a PPX-built%todo("x")arriving as the node.Stacked on #9160.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gJFAva9685fjvkajub