Skip to content

Remove the call-site @inlined attribute - #8734

Open
cknitt wants to merge 7 commits into
masterfrom
remove-inlined-attribute
Open

cknitt wants to merge 7 commits into
masterfrom
remove-inlined-attribute

Conversation

@cknitt

@cknitt cknitt commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Removes the call-site @inlined attribute, as proposed in #8733.

@inlined was translated into Lapply.ap_inlined, but no pass in compiler/core ever read it: its only use, in lam_pass_remove_alias.ml, was commented out. Today:

Call Before this PR
(@inlined f)(x) accepted silently, never inlined
(@inlined(never) f)(x) with @inline let f still inlined
@inlined f(x) (the natural ReScript placement) already warning 53 "cannot appear in this context"

No code in this repository uses it.

This deletes the attribute's translation (get_and_remove_inlined_attribute(_on_module)) and the ap_inlined field of Lambda.ap_info, together with its Lambda printer case. check_attribute already had an "inlined" case, so any remaining @inlined, on an expression or a functor application, is now reported as a misplaced attribute (warning 53) instead of being silently ignored. Generated JavaScript doesn't change.

For the warning to behave like any other attribute check:

  • A fully applied primitive is translated without passing its callee through transl_exp, so the callee's attributes are now checked there too, in the callee's warning scope. (@inlined id)(1) with an external id warns, and (@warning("-53") @inlined id)(1) doesn't. A misplaced @inline on such a callee is now reported as well.
  • Module expressions are now translated in the warning scope of their attributes, as expressions already are, so (@warning("-53") @inlined F)(X) is silent. @warning on a module expression therefore also applies to other warnings reported while translating it.

ap_info is now a single-field record {ap_loc}; #8736, stacked on this PR, replaces it with a plain location.

Since .cmj files store marshalled Lambda terms (including Lapply), their layout changes with this PR. They're rebuilt with the compiler anyway.

Tests

  • super_errors/warning_53_inlined_attribute.res: @inlined on a function in parentheses, on an application and on an external, each reported as warning 53, and on an external under @warning("-53"), which isn't.

The functor-application case (module M = @inlined F({})) also reports warning 53, but it can't be in a fixture: the ReScript formatter drops attributes on functor applications (it prints F()), so the format check rejects it. That printer bug is fixed in #8735; once it's merged, I'll add the functor-application cases, including the @warning("-53") one, to the fixture.

🤖 Generated with Claude Code

cknitt and others added 3 commits October 7, 2026 09:55
@inlined was translated into Lapply's ap_inlined, but no pass in
compiler/core ever read it: the only use in lam_pass_remove_alias was
commented out. So (@inlined f)(x) was accepted and ignored,
(@inlined(never) f)(x) still inlined, and the natural ReScript placement
@inlined f(x) already reported warning 53.

Delete the attribute's translation and the ap_inlined field. Any
remaining @inlined now reaches check_attribute and is reported as a
misplaced attribute (warning 53) instead of being silently ignored.

See #8733.

Signed-off-by: Christoph Knittel <[email protected]>

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Christoph Knittel <[email protected]>

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The formatter drops attributes on functor applications, so @inlined F({}) cannot appear in a formatted fixture. Cover the two expression placements only.

Signed-off-by: Christoph Knittel <[email protected]>

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.87%. Comparing base (d7ffff5) to head (f1086aa).

Files with missing lines Patch % Lines
compiler/ml/translcore.ml 40.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8734   +/-   ##
=======================================
  Coverage   79.86%   79.87%           
=======================================
  Files         464      464           
  Lines       63090    63079   -11     
=======================================
- Hits        50388    50383    -5     
+ Misses      12702    12696    -6     
Files with missing lines Coverage Δ
compiler/core/lam_pass_remove_alias.ml 82.07% <100.00%> (ø)
compiler/ml/lambda.ml 67.00% <ø> (ø)
compiler/ml/lambda_traverse.ml 93.67% <100.00%> (ø)
compiler/ml/printlambda.ml 9.60% <ø> (+0.11%) ⬆️
compiler/ml/translattribute.ml 78.18% <ø> (+0.05%) ⬆️
compiler/ml/translmod.ml 96.19% <100.00%> (+0.03%) ⬆️
tests/ounit_tests/ounit_lambda_traverse_tests.ml 100.00% <100.00%> (ø)
compiler/ml/translcore.ml 86.48% <40.00%> (+0.14%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pkg-pr-new

pkg-pr-new Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript@8734

@rescript/belt

npm i https://pkg.pr.new/@rescript/belt@8734

@rescript/darwin-arm64

npm i https://pkg.pr.new/@rescript/darwin-arm64@8734

@rescript/darwin-x64

npm i https://pkg.pr.new/@rescript/darwin-x64@8734

@rescript/linux-arm64

npm i https://pkg.pr.new/@rescript/linux-arm64@8734

@rescript/linux-x64

npm i https://pkg.pr.new/@rescript/linux-x64@8734

@rescript/runtime

npm i https://pkg.pr.new/@rescript/runtime@8734

@rescript/win32-x64

npm i https://pkg.pr.new/@rescript/win32-x64@8734

commit: f1086aa

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

@cknitt
cknitt marked this pull request as ready for review October 7, 2026 15:48
@cknitt

cknitt commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T18:06:42.581045Z f1086aa Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7393a3cfc2

ℹ️ 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".

Comment thread compiler/ml/translcore.ml Outdated
cknitt and others added 2 commits October 7, 2026 15:59
A fully applied primitive call is translated without passing its callee
through transl_exp, so check_attribute never saw the callee's attributes
and `(@inlined id)(1)` with an external `id` got no warning. Check them
on that path too.

Signed-off-by: Christoph Knittel <[email protected]>

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Christoph Knittel <[email protected]>

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cknitt

cknitt commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ca575448b3

ℹ️ 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".

Comment thread compiler/ml/translcore.ml Outdated
The attribute check added for fully applied primitives ran outside the
callee's warning scope, so `(@warning("-53") @inlined id)(1)` still
reported warning 53. Run it in the same scope transl_exp uses.

Signed-off-by: Christoph Knittel <[email protected]>

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cknitt

cknitt commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f38610c587

ℹ️ 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".

Comment thread compiler/ml/translattribute.ml
With @inlined no longer removed from a functor application's callee, it
reaches check_attribute_on_module, which ran outside any warning scope:
`(@warning("-53") @inlined F)(X)` still reported warning 53. Translate a
module expression inside the warning scope of its attributes, like
transl_exp does for expressions.

Signed-off-by: Christoph Knittel <[email protected]>

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cknitt

cknitt commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: f1086aa19d

ℹ️ 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".

@cknitt
cknitt requested a review from cristianoc October 7, 2026 18:32

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant