Skip to content

Uncurried mode regression 11.0.0-rc.6 #6504

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

Closed
DZakh opened this issue Dec 1, 2023 · 3 comments · Fixed by #6507
Closed

Uncurried mode regression 11.0.0-rc.6 #6504

DZakh opened this issue Dec 1, 2023 · 3 comments · Fixed by #6507

Comments

@DZakh
Copy link
Member

DZakh commented Dec 1, 2023

After migrating to uncurried mode I've got an unexpected runtime error:

https://rescript-lang.org/try?version=v11.0.0-rc.6&code=DYUwLgBAZgdhC8EDGAjBA+CBvAUBZKAFAJQ4C+OOshAzhhAFI0B0wA9gOaEDEUbbtYkJwB6ERADi4CACIAqjCQBDAK4cAFpABKIKCABOIRSACi+-W30AuCHQCWdGG0gATXXZggXMnEA

@WhyThat
Copy link

WhyThat commented Dec 4, 2023

I think it's related to this too
https://forum.rescript-lang.org/t/the-big-migration-thread-for-rescript-v11-and-uncurried-mode/4769/36

@cristianoc
Copy link
Collaborator

Probably related to this optimisation:
#6131

where type inference gives the function unit type

let fn = cb => {
  cb()
}

fn(s => Js.log(#foo(s)))

cristianoc added a commit that referenced this issue Dec 5, 2023
Fixes #6504

Uncurried functions with 1 unit argument are emitted without the parameter. This leaves a possible undefined id in the emitted code if the parameter is a variable.
This PR limits the optimization to cases where the parameter is explicitly `()`, as opposed to e.g. a variable whose type is inferred to be unit.
cristianoc added a commit that referenced this issue Dec 5, 2023
Fixes #6504

Uncurried functions with 1 unit argument are emitted without the parameter. This leaves a possible undefined id in the emitted code if the parameter is a variable.
This PR limits the optimization to cases where the parameter is explicitly `()`, as opposed to e.g. a variable whose type is inferred to be unit.
cristianoc added a commit that referenced this issue Dec 5, 2023
Fixes #6504

Uncurried functions with 1 unit argument are emitted without the parameter. This leaves a possible undefined id in the emitted code if the parameter is a variable.
This PR limits the optimization to cases where the parameter is explicitly `()`, as opposed to e.g. a variable whose type is inferred to be unit.
cristianoc added a commit that referenced this issue Dec 5, 2023
Fixes #6504

Uncurried functions with 1 unit argument are emitted without the parameter. This leaves a possible undefined id in the emitted code if the parameter is a variable.
This PR limits the optimization to cases where the parameter is explicitly `()`, as opposed to e.g. a variable whose type is inferred to be unit.
@cristianoc
Copy link
Collaborator

Both issues reported above have in fact the same cause -- fixed in #6507

cristianoc added a commit that referenced this issue Dec 5, 2023
Fixes #6504

Uncurried functions with 1 unit argument are emitted without the parameter. This leaves a possible undefined id in the emitted code if the parameter is a variable.
This PR limits the optimization to cases where the parameter is explicitly `()`, as opposed to e.g. a variable whose type is inferred to be unit.
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 a pull request may close this issue.

3 participants