Repository navigation
Do not skip arity checks for functions in negation form - #16123
Merged
Merged
Conversation
josevalim
force-pushed
the
jv-fun-negation
branch
from
November 12, 2026 16:12
fb172b1 to
83dc8a1
Compare
gldubc
reviewed
Nov 21, 2026
gldubc
left a comment
Member
There was a problem hiding this comment.
The changes are all good!
One thing to fix: the hint with :mixed_arity. In general this correctly says that the function has multiple arities, so you should select it with a guard function(_, n).
But it might be that the arity you wanted is actually not in the function.
For instance take type fun() and not (fun(1) or fun(2)), which appears as {:negation, [1, 2]}.
Trying to call this with arity 1 will tell you to refine with a guard is_function_, 1), which does not work.
Si the :mixed_arity hint should only be shown, in the :negative case, if the arity n of the argument is not in the negative arities list.
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.
Closes #16103.
Closes #16104.