We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
let a = ref(None)
var a;
The following code:
for i in 1 to 5 { let a = ref(None) if i == 3 { a := Some(3) } Js.log(a.contents) }
gets compiled to:
for(var i = 1; i <= 5; ++i){ var a; if (i === 3) { a = 3; } console.log(a); }
rescript playground
reason playground
Expected result: Variable a is re-initialized to undefined in each iteration of the loop.
a
undefined
undefined undefined 3 undefined undefined
Actual result:
undefined undefined 3 3 3
Correct compilation result should be:
for(var i = 1; i <= 5; ++i){ var a = undefined; if (i === 3) { a = 3; } console.log(a); }
The text was updated successfully, but these errors were encountered:
I guess this will indirectly fix the issue? #6102
Sorry, something went wrong.
As a workaround you can use null from RescriptCore:
for i in 1 to 5 { let a = ref(null) if i == 3 { a := Value(3) } Js.log(a.contents) }
Fixed in v12 via #6102.
No branches or pull requests
The following code:
gets compiled to:
rescript playground
reason playground
Expected result:
Variable
a
is re-initialized toundefined
in each iteration of the loop.Actual result:
Correct compilation result should be:
The text was updated successfully, but these errors were encountered: