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

Recursive function with no parameters generate while loop which contains assignment to undeclared _param variable #6719

Open
3 of 5 tasks
hackwaly opened this issue Apr 7, 2024 · 2 comments

Comments

@hackwaly
Copy link

hackwaly commented Apr 7, 2024

Thank you for filing! Check list:

  • Is it a bug? Usage questions should often be asked in the forum instead.
  • Concise, focused, friendly issue title & description.

Recursive function with no parameters generate while loop which contains assignment to undeclared _param variable

let test = () => {
  let rec loop = () => {
    switch () {
    | _ => loop()
    }
  }
  loop()
}
// Generated by ReScript, PLEASE EDIT WITH CARE


function test() {
  var loop = function () {
    while(true) {
      _param = undefined;
      continue ;
    };
  };
  return loop();
}

export {
  test ,
}
/* No side effect */
@hackwaly
Copy link
Author

hackwaly commented May 6, 2024

Any plan to fix this bug?

@philiparvidsson
Copy link

The biggest problem I see with this is that it will silently freeze instead of overflow the stack...

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

No branches or pull requests

2 participants