Skip to content

Test: ignore inferred arity in case of %raw. #7542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiler/core/lam_arity_analysis.ml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ let rec get_arity (meta : Lam_stats.t) (lam : Lam.t) : Lam_arity.t =
with
| Submodule subs -> subs.(m) (* TODO: shall we store it as array?*)
| Single _ -> Lam_arity.na)
| Lprim {primitive = Praw_js_code {code_info = Exp (Js_function {arity})}} ->
| Lprim {primitive = Praw_js_code {code_info = Exp (Js_function {arity})}}
when false ->
Lam_arity.info [arity] false
Comment on lines +73 to 74
Copy link
Preview

Copilot AI Jun 13, 2025

Choose a reason for hiding this comment

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

[nitpick] This when false guard disables the raw JS arity branch but leaves dead code. It may be clearer to remove the branch or use a descriptive compile‐time flag plus comments to document why it's disabled.

Suggested change
when false ->
Lam_arity.info [arity] false
when ENABLE_RAW_JS_ARITY ->
Lam_arity.info [arity] false
(* The ENABLE_RAW_JS_ARITY flag controls whether the raw JS arity branch is enabled.
This branch is currently disabled for performance reasons and because it is not
required in the current implementation. Enable it by defining ENABLE_RAW_JS_ARITY
as true at compile time if needed in the future. *)

Copilot uses AI. Check for mistakes.

| Lprim {primitive = Praise; _} -> Lam_arity.raise_arity_info
| Lglobal_module _ (* TODO: fix me never going to happen *) | Lprim _ ->
Expand Down
3 changes: 2 additions & 1 deletion compiler/core/lam_pass_collect.ml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ let collect_info (meta : Lam_stats.t) (lam : Lam.t) =
{
primitive = Praw_js_code {code_info = Exp (Js_function {arity})};
args = _;
} ->
}
when false ->
Copy link
Preview

Copilot AI Jun 13, 2025

Choose a reason for hiding this comment

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

[nitpick] Using a when false guard makes this branch permanently unreachable. Consider removing the dead code or replacing the guard with a named feature flag and an explanatory comment to clarify intent.

Copilot uses AI. Check for mistakes.

Hash_ident.replace meta.ident_tbl ident
(FunctionId {arity = Lam_arity.info [arity] false; lambda = None})
| Lprim {primitive = Pnull_to_opt; args = [(Lvar _ as l)]; _} ->
Expand Down
Loading