Skip to content
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

Special case uncurried fun with 1 arg of unit type #6131

Merged
merged 13 commits into from
Apr 12, 2023
Merged

Conversation

cristianoc
Copy link
Collaborator

@cristianoc cristianoc commented Apr 11, 2023

Special case generation of uncurried functions with 1 argument of unit type so they don't take a parameter.

@cristianoc cristianoc requested a review from cknitt April 11, 2023 14:30
@cristianoc
Copy link
Collaborator Author

@cknitt would you test that this works? I'd need to check certain aspects of the implementation but first I'd like to be sure it works.

jscomp/test/UncurriedExternals.js Outdated Show resolved Hide resolved
jscomp/test/ffi_arity_test.js Outdated Show resolved Hide resolved
jscomp/test/ffi_arity_test.js Outdated Show resolved Hide resolved
jscomp/stdlib-406/camlinternalLazy.res Outdated Show resolved Hide resolved
@cknitt cknitt changed the title Specia case uncurried fun with 1 arg of unit type Special case uncurried fun with 1 arg of unit type Apr 11, 2023
Instead of removing the arguments on the lambda layer, pass the information down via the lambda layer using the additional field oneUnitArg.

When this reaches the Lam layer with ocaml_fun in Lam_compile, only then remove the param.

This ensures the code emitted is the same, except for the parameter.
@cristianoc cristianoc requested a review from cknitt April 12, 2023 02:52
@cristianoc
Copy link
Collaborator Author

@cknitt check again

@cknitt
Copy link
Member

cknitt commented Apr 12, 2023

Works great now, but as discussed it only applies to explicit uncurrying / uncurried mode, not to the @uncurry annotation.

So we still have a breaking change in v11 regarding @uncurry here.

@cristianoc cristianoc merged commit bbf4fbc into master Apr 12, 2023
2 checks passed
@cristianoc cristianoc deleted the uncurried_unit branch April 12, 2023 10:28
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.

None yet

2 participants