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

Change AndThen to directly check isRightAssociated #3569

Merged
merged 1 commit into from
Aug 15, 2020

Conversation

johnynek
Copy link
Contributor

@johnynek johnynek commented Aug 14, 2020

fix #3568

The change to address the above is to avoid equal which on a very deep structure can blow the stack. Instead, directly check the property we want: isRightAssociated.

I removed a microoptimization (using != instead of <) since I would be SHOCKED if that changed the perf of this code which has to do quite a bit of pattern matching already. The != is not very safe since if a refactor gets it wrong, it can easily blow past the limit.

Lastly, I couldn't resist a bit of refactoring to share more of the code and improve associations (still at O(1) cost per andThen/compose).

cc @travisbrown

@codecov-commenter
Copy link

Codecov Report

Merging #3569 into master will increase coverage by 0.04%.
The diff coverage is 96.00%.

@@            Coverage Diff             @@
##           master    #3569      +/-   ##
==========================================
+ Coverage   91.28%   91.32%   +0.04%     
==========================================
  Files         386      386              
  Lines        8605     8611       +6     
  Branches      246      250       +4     
==========================================
+ Hits         7855     7864       +9     
+ Misses        750      747       -3     

@travisbrown travisbrown self-requested a review August 15, 2020 05:00
Copy link
Contributor

@travisbrown travisbrown left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@johnynek johnynek merged commit f079a79 into master Aug 15, 2020
@travisbrown travisbrown added this to the 2.2.0-RC3 milestone Aug 15, 2020
@travisbrown
Copy link
Contributor

By the way I'm marking this as an enhancement instead of a bugfix for the release notes, since the buggy part has never been released.

@larsrh larsrh deleted the oscar/fix_andthen_equals_test branch September 19, 2020 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

toRightAssociated test failure in CI
3 participants