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

Fix closure representation in the Nock backend #3105

Merged
merged 10 commits into from
Oct 18, 2024
Merged

Fix closure representation in the Nock backend #3105

merged 10 commits into from
Oct 18, 2024

Conversation

lukaszcz
Copy link
Collaborator

@lukaszcz lukaszcz commented Oct 16, 2024

The representation of closures is changed to make it more efficient and compatible with the Nock calling convention.

@lukaszcz lukaszcz added this to the 0.6.7 milestone Oct 16, 2024
@lukaszcz lukaszcz self-assigned this Oct 16, 2024
@lukaszcz lukaszcz marked this pull request as ready for review October 18, 2024 14:57
Copy link
Collaborator

@paulcadman paulcadman left a comment

Choose a reason for hiding this comment

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

Is it possible to add additional tests that use currying that would have failed with the previous approach?

@lukaszcz
Copy link
Collaborator Author

Is it possible to add additional tests that use currying that would have failed with the previous approach?

The old way of handling closures is correct "internally" -- as long as we're using the old closure calling convention everywhere. The problem is that the old calling convention doesn't match the Nock calling convention, so it would crash if a partially applied function is called externally by Nock. But we're not testing against the actual Nock interpreter right now, so it's hard to add a new test for that.

This is partially tested in anomaCallingConventionTests where applyFun uses the Nock calling convention (as far as I understand it). It's used with partially applied (curried) functions in the tests, so curryClosure is tested there.

@paulcadman
Copy link
Collaborator

Is it possible to add additional tests that use currying that would have failed with the previous approach?

The old way of handling closures is correct "internally" -- as long as we're using the old closure calling convention everywhere. The problem is that the old calling convention doesn't match the Nock calling convention, so it would crash if a partially applied function is called externally by Nock. But we're not testing against the actual Nock interpreter right now, so it's hard to add a new test for that.

This is partially tested in anomaCallingConventionTests where applyFun uses the Nock calling convention (as far as I understand it). It's used with partially applied (curried) functions in the tests, so curryClosure is tested there.

This makes sense thanks.

@paulcadman paulcadman merged commit 5d32e8f into main Oct 18, 2024
4 checks passed
@paulcadman paulcadman deleted the nock-closures branch October 18, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants