Skip to content

Change AndThen to directly check isRightAssociated#3569

Merged
johnynek merged 1 commit into
masterfrom
oscar/fix_andthen_equals_test
Aug 15, 2020
Merged

Change AndThen to directly check isRightAssociated#3569
johnynek merged 1 commit into
masterfrom
oscar/fix_andthen_equals_test

Conversation

@johnynek
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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