Repository navigation
Conversation
Why:
The @this rewrite left @directive on the unsafe_to_method call
instead of the function, and the Pjs_fn_method path built the JS
function without a directive, so it was dropped without a report.
The PPX now moves @directive onto the inner function, E.method_
takes it, and the printer puts it before `let self = this`, since a
directive must be the first statement of the body.
JS modified (@this function with a directive):
Example:
let plain = @this @directive("'use cache'") (self, x) => self + x
Before (js):
function plain(x) {
let self = this ;
return self + x | 0;
}
After (js):
function plain(x) {
'use cache';
let self = this ;
return self + x | 0;
}
Fixes #9197
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gJuq6rWZULJVY3ATmY
Signed-off-by: Christoph Knittel <ck@cca.io>
Changelog🐛 Bug fix
Semantic Diff2 commits · Full page Keep
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
🚀 New features to boost your workflow:
|
rescript
@rescript/belt
@rescript/darwin-arm64
@rescript/linux-arm64
@rescript/linux-x64
@rescript/runtime
@rescript/win32-x64
commit: |
The space was left over from when the printer spelled out `let self =` by hand; no other statement puts a space before its semicolon. JS modified (@this function): Example: let even = @this (o, x) => x + o Before (js): let o = this ; After (js): let o = this; Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kbf3gJuq6rWZULJVY3ATmY Signed-off-by: Christoph Knittel <ck@cca.io>
|
@codex review |
Codex Review Summary: ✅ CompletedThis 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: ac091eec07
ℹ️ 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".
|
Developer playground preview: https://rescript-lang.github.io/rescript/dev-playground/?version=pr-9262 |
|
@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". |
Fixes #9197.
@thisfunctions dropped their@directive. There were two causes:bs_builtin_ppxleft the attribute on theunsafe_to_methodcall instead of the function, which is where translcore reads it. The PPX now moves@directiveonto the inner function.Pjs_fn_methodignoreddirective, andE.method_had no parameter for it.lam_compilenow passes it through.A directive has to be the first statement of the body, so
Js_dumpprints it beforelet self = this. This also works for async functions and whenselfis unused.New test:
tests/tests/src/this_directive.res, a JS snapshot covering the plain, async and unused-selfcases.🤖 Generated with Claude Code
https://claude.ai/code/session_01Kbf3gJuq6rWZULJVY3ATmY