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

Possible issue 6830 fix #7526

Closed
wants to merge 2 commits into from
Closed

Conversation

gamaamaral98
Copy link

Summary

This change was motivated by a college discipline. We were asked to pick a open source project and then choose two issues to solve.

Test plan

The problem before was the fact that when using Iterables the program would get stuck in a infinite loop when making recursive calls. We added a global variable to control how many times the function can recurse. Once a counter is bigger than the control variable the function returns. This way the program can't produce the error: RangeError: Maximum call stack size exceeded. As the controler is a global variable, the value can be changed to the value the programmer wishes.

image

Here is an image that shows that the alteration made to the code works for the example used. The example that was used was originally proposed by another contributor.

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

This looks good! I left an inline comment, and could you also update the changelog, please? 🙂

return true;
}
}
}

const bIterator = b[IteratorSymbol]();

for (const aValue of a) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you put count and iterableControler (also typo, but call it maxIterations or something) here, instead of at the top level?
If that messes up, at least put count at the top of iterableEquality so that we avoid the value leaking across assertions 🙂

Copy link
Author

Choose a reason for hiding this comment

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

Sure, I will do it right away! Thanks for the feedback and the help. Any ideas why it didn't pass through all the checks?

Copy link
Author

Choose a reason for hiding this comment

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

Should I keep the count = 0 everytime the program returns or delete it and only let it inside the cycle?

Copy link
Member

Choose a reason for hiding this comment

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

Reset it for every time the equality function is called

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants