-
Notifications
You must be signed in to change notification settings - Fork 3k
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
dialyzer: false positive "overlapping domains" error #6117
Comments
It seems that there should be some magical threshold in dialyzer - the error is gone if any of element of the type |
I think you should pay more attention to the detail(s). This is not an error (or false positive). It's just a warning from Dialyzer simply informing its user that it will discard (i.e., not take into account in its analysis) the spec of this function because the underlying type representation (which indeed has constraints / magical thresholds) makes Dialyzer think that the domains are overlapping. So, read this as a prompt to write the spec differently (e.g., as a simple spec and not as an overloaded contract). Of course, it's a matter of taste / preferences whether it's a good idea to print this information by default or for having an option to silence these kinds of messages. |
@kostis I would say the key information missing in the warning message is that the domains have been "collapsed" due to constraints / magical thresholds and that's why they are overlapping. Otherwise, without having internal knowledge of if/when/how it happens, most users will assume they have indeed made a mistake and declared overlapped domains themselves. |
UPDATE: this is a wrong example, - there is a shared element - an empty list.Some much simpler case - that we got in our codebase today. A simplified version:
But "obviously" (for humans) the domains are disjoint here. |
@ilya-klyuchnikov, your example can be further simplified and still produce the same warning:
Written that way, it is somewhat easier to see that the domains indeed do overlap. The overlap is
With that spec, there is no warning. |
I have recategorized this issue as a feature request to implement support for overlapping domains. It seems that in principle that can be done by using the union (a.k.a. supremum or meet) of the domains of the contracts, and similarly for the return types. It need to be determined whether that will cause unintended consequences or cause other problems. |
Yes, - I was too harsh - the last example is about overlapped domains indeed. My bad. |
it seems like Dialyzer is already doing the union (supremum) of the domains. |
…-domains/GH-6117/OTP-18342 Sets overloaded domains/contracts as an opt-in flag OTP-18342
Describe the bug
Dialyzer produces "overlapping domains" error for "obviously non-overlapping" domains.
To Reproduce
Expected behavior
the types/sets constants are non-overlapping - they are tagged tuples with distinct tags.
Affected versions
25.0.2
The text was updated successfully, but these errors were encountered: