Avoid applying map update callbacks to absent branches#15248
Open
gldubc wants to merge 3 commits intoelixir-lang:mainfrom
Open
Avoid applying map update callbacks to absent branches#15248gldubc wants to merge 3 commits intoelixir-lang:mainfrom
gldubc wants to merge 3 commits intoelixir-lang:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15208.
map_updatewith a function callback passes afun_applydown into the map BDD so it can typecheck the callback against the current value.The problem was that this also happened on branches where the domain key does not exist at all. On those branches, such as
empty_map(), we were callingfun_applywithnone().That is not useful: the callback is supposed to be checked against values that may actually come from the map. Passing
none()can manufacture bogus failures, and in this case it eventually led to the crash from #15208 with remote captures like&Helpers.transform/1.The fix is to stop invoking the callback on absent-key branches for non-forced updates. If the key is missing, that branch should just behave like a failed update, instead of pretending the callback was applied to
none().I also added a regression at the descriptor layer that checks we do not call the callback with
none()from absent branches.