Skip to content

Test cross-module inlining against a twin that isn't inlined - #9540

Open
cknitt wants to merge 1 commit into
inline-through-aliasesfrom
inline-twin-test
Open

cknitt wants to merge 1 commit into
inline-through-aliasesfrom
inline-twin-test

Conversation

@cknitt

@cknitt cknitt commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

A differential test for cross-module inlining. inline_twin_lib.res defines each helper twice with the same body, once @inline and once @inline(never), and inline_twin_test.res runs the same cases against both and expects the same results.

The cases are options at payload types that can and can't be undefined (unit, nested options, Nullable, an unboxed type with an undefined case, 'a), the order of arguments with side effects, and a Some of a ref that a callback assigns after the call.

Each case fails when the compiler is broken on purpose: taking every option payload as unable to be undefined fails 10 of them, binding inlined arguments in reverse order fails the order case, and substituting any pure Some payload fails the two Some cases. Cases that failed under no such change were left out.

Test only, so no changelog fragment.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Kbf3gHZYwA1rq7zbk3dhQq

@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Changelog

No changelog entry.

Semantic Diff

1 commit · Full page

Test cross-module inlining against a twin that isn't inlined

9392b02 · cknitt + Claude · Dec 05, 2026, 10:16 UTC

Why

The tests of each inlining change check its own repros. This test calls helpers twice the same way, once @inline and once @inline(never), and expects the same result. Its cases are options at payload types that can and can't be undefined (unit, nested options, Nullable, an unboxed type with an undefined case, 'a), the order of arguments with side effects, and a Some of a ref that a callback assigns after the call.

Review

  • Why only these cases? They are the ones that fail when the compiler is broken on purpose. Taking every option payload as unable to be undefined fails 10 of them, binding inlined arguments in reverse order fails the order case, and substituting any pure Some payload fails the two Some cases. Cases that failed under no such change were removed. Every @inline helper is inlined in the output, and each @inline(never) one is called.

@cknitt
cknitt changed the base branch from master to inline-through-aliases December 5, 2026 10:20
@cknitt
cknitt added this pull request to stack #9541 December 5, 2026 10:20
@cknitt

cknitt commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-05T10:51:32.819760Z 769e026 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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 998c38f199

ℹ️ 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 added the changelog:skip No release notes needed label Dec 5, 2026
@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

✅ Compiler benchmarks

Allocated words

In total: 661,170,021 → 661,170,384 (±0.00%).

Generated projects: 628,260,820 → 628,261,219 (±0.00%).

None of the 265 benchmarks changed by 0.1% or more.

Instructions

In total: 8,946,906,545 → 8,946,906,545 (±0.00%).

None of the 33 benchmarks changed by 0.1% or more.

Output size

In total: 27,780,923 → 27,780,923 (±0.00%).

None of the 13 benchmarks changed by 0.1% or more.

Pull request 9392b02 compared with base 6f8a5ab in this run.

@pkg-pr-new

pkg-pr-new Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

rescript

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

@rescript/belt

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

@rescript/darwin-arm64

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

@rescript/linux-arm64

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

@rescript/linux-x64

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

@rescript/runtime

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

@rescript/win32-x64

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

commit: 9392b02

@cknitt

cknitt commented Dec 5, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 769e026370

ℹ️ 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 force-pushed the inline-twin-test branch 2 times, most recently from 6a53c60 to 47909af Compare December 5, 2026 12:48
Why:
    The tests of each inlining change check its own repros. This test
    calls helpers twice the same way, once `@inline` and once
    `@inline(never)`, and expects the same result. Its cases are options
    at payload types that can and can't be `undefined` (`unit`, nested
    options, `Nullable`, an unboxed type with an `undefined` case, `'a`),
    the order of arguments with side effects, and a `Some` of a ref that
    a callback assigns after the call.

Review: Why only these cases? They are the ones that fail when the
compiler is broken on purpose. Taking every option payload as unable to
be `undefined` fails 10 of them, binding inlined arguments in reverse
order fails the order case, and substituting any pure `Some` payload
fails the two `Some` cases. Cases that failed under no such change were
removed. Every `@inline` helper is inlined in the output, and each
`@inline(never)` one is called.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gHZYwA1rq7zbk3dhQq
Signed-off-by: Christoph Knittel <ck@cca.io>
@cknitt
cknitt marked this pull request as ready for review December 5, 2026 13:12
@cknitt
cknitt requested a review from cristianoc December 5, 2026 13:12

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

changelog:skip No release notes needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant