Make Lambda invariant checking explicit - #8534
Merged
Merged
Conversation
Replace the compile-time RELEASE distinction with a -check-lam runtime option. This keeps dev, release, and static compilers functionally identical while leaving Dune profiles responsible only for native optimization and browser selection. Enable the option for the main compiler test project so Lambda invariants are exercised across ordinary local and CI test compilations and appear in coverage. Include the pass name in failures to make regressions actionable. Keep -bs-diagnose as the umbrella diagnostic mode: it enables Lambda checks and owns all Lambda and JavaScript dump calls. Gating dumps at their call sites makes that relationship explicit and avoids duplicated configuration checks inside the dump implementations. Remove the dump-specific BROWSER conditionals because the browser API cannot activate diagnose and js_of_ocaml eliminates the unreachable dump paths. A measured playground build had identical raw size, so retaining compile-time stubs added complexity without reducing the bundle. Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com>
Signed-off-by: Cristiano Calcagno <cristianoc@users.noreply.github.com>
cristianoc
marked this pull request as ready for review
August 9, 2026 09:07
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8534 +/- ##
==========================================
- Coverage 74.59% 74.59% -0.01%
==========================================
Files 458 458
Lines 62302 62303 +1
==========================================
- Hits 46477 46476 -1
- Misses 15825 15827 +2
🚀 New features to boost your workflow:
|
rescript
@rescript/darwin-arm64
@rescript/darwin-x64
@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-8534 |
Member
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 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". |
cknitt
approved these changes
Aug 9, 2026
cknitt
left a comment
Member
There was a problem hiding this comment.
Great to get rid of that RELEASE flag! 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-check-lamcompiler option-bs-diagnoseimply Lambda checkingRELEASECPPO distinctionWhy
There is no user-visible debug versus release compiler behavior. Lambda checking was compiled into some native builds and omitted from release builds, which made coverage and regression detection depend on how the compiler was built. This makes checking explicit and keeps dev/release/static compilers functionally identical; Dune profiles now differ only for native optimization and browser selection.
The dump calls are explicitly owned by
-bs-diagnose. Browser-specific dump stubs were removed after verifying js_of_ocaml eliminates the unreachable diagnose path without changing the raw playground bundle size.Validation
make test-check-lamsmoke compilationsmake checkformatStack
This is PR 1 of 2. The follow-up IR diagnostics cleanup targets this branch.