Skip to content

Remove the call-site @inlined attribute - #8734

Draft
cknitt wants to merge 3 commits into
masterfrom
remove-inlined-attribute
Draft

cknitt wants to merge 3 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.

ap_info is now a single-field record {ap_loc}. I left it as a record to keep this diff focused; it could be replaced by a plain location in a follow-up.

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 and on an application, each reported as warning 53.

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 pre-existing and separate from this PR.

🤖 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 <christoph@knittel.cc>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Christoph Knittel <christoph@knittel.cc>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 <christoph@knittel.cc>

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 7, 2026

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
compiler/ml/translcore.ml 25.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8734   +/-   ##
=======================================
  Coverage   79.86%   79.87%           
=======================================
  Files         464      464           
  Lines       63090    63074   -16     
=======================================
- Hits        50388    50378   -10     
+ Misses      12702    12696    -6     
Files with missing lines Coverage Δ
compiler/core/lam_pass_remove_alias.ml 82.07% <ø> (ø)
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.13% <ø> (-0.02%) ⬇️
tests/ounit_tests/ounit_lambda_traverse_tests.ml 100.00% <100.00%> (ø)
compiler/ml/translcore.ml 86.43% <25.00%> (+0.09%) ⬆️
🚀 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: 7393a3c

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

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