Repository navigation
Fix %todo with a local JsError module, and the location in its message - #9160
Conversation
Changelog🐛 Bug fix
Semantic Diff2 commits · Full page Expand %todo to the standard library's JsError, located like __LOC__1d4c028 · cknitt + Claude · Nov 01, 2026, 08:12 UTC
JS modified (%todo with a local JsError module) module JsError = {
let throwWithMessage = (s: string) => s
}
let f = (_: int): int => %todo("later")
function f(param) {
return Stdlib_JsError.throwWithMessage("A.res:4:25-30 - Todo: later");
}JS modified (%todo message) let a = 1
let f = () => %todo
-return Stdlib_JsError.throwWithMessage("/home/me/app/src/D.res:2:24-29 - Todo");
+return Stdlib_JsError.throwWithMessage("D.res:2:14-19 - Todo");✨ Allow the %todo warning in the tests project instead of in the test0c2890f · cknitt + Claude · Nov 01, 2026, 16:10 UTC · new Every %todo reports warning 110, which the tests project turned into an error. Answers the Codex review on #9160: rather than disabling the warning in todo_shadowing_test.res, the project keeps 110 a warning (-warn-error A-110), and every other warning stays an error. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9160 +/- ##
=======================================
Coverage 81.67% 81.67%
=======================================
Files 455 455
Lines 64859 64859
=======================================
Hits 52974 52974
Misses 11885 11885
🚀 New features to boost your workflow:
|
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-9160 |
2640a01 to
afe9483
Compare
Why:
%todo called `JsError.throwWithMessage` by name, so a user module named
JsError replaced it. Its message also embedded the absolute path of the
source file, and character offsets from the start of the file as columns.
JS modified (%todo with a local JsError module):
Example:
module JsError = {
let throwWithMessage = (s: string) => s
}
let f = (_: int): int => %todo("later")
Before (diagnostic):
This has type: string
But it's expected to have type: int
After (js):
function f(param) {
return Stdlib_JsError.throwWithMessage("A.res:4:25-30 - Todo: later");
}
JS modified (%todo message):
Example:
let a = 1
let f = () => %todo
Before (js): return Stdlib_JsError.throwWithMessage("/home/me/app/src/D.res:2:24-29 - Todo");
After (js): return Stdlib_JsError.throwWithMessage("D.res:2:14-19 - Todo");
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>
afe9483 to
1d4c028
Compare
|
@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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d4c028142
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
Every %todo reports warning 110, which the tests project turned into an error. Answers the Codex review on #9160: rather than disabling the warning in todo_shadowing_test.res, the project keeps 110 a warning (-warn-error A-110), and every other warning stays an error. 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>
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! 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
%todoexpands to a call ofJsError.throwWithMessage, resolved by name in the user's scope. A module namedJsErrorin the user's code replaces the standard library one:The message the expansion throws had two more problems:
What changes
Stdlib_JsError.throwWithMessage, the compilation unit, asAst_literalalready does forStdlib_RegExp.__LOC__: the file's base name and 0-based columns, so/home/me/app/src/D.res:2:24-29 - TodobecomesD.res:2:14-19 - Todo.Tests
tests/tests/src/todo_shadowing_test.resdefines a localJsErrorand checks that a%todostill throws. Its generated JS also pins the new message format. Every%todoreports warning 110, so the tests project now keeps that one warning from being an error (-warn-error A-110); all other warnings stay errors.First of three PRs for the
%todo/%debuggeritems of #8624. Next: aPexp_todoparsetree node (stacked on this one).🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gJFAva9685fjvkajub