-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Describe the bug
OTP 27 introduced a bunch of specs with overloaded contracts that have overlapping domains, - that makes them unusable (and detrimental) for tooling (like type-checkers).
Examples:
-
socket:open/2:
Lines 2719 to 2732 in 3ff36ef
-spec open(FD, Opts) -> {'ok', Socket} | {'error', Reason} when FD :: integer(), Opts :: #{'domain' => domain() | integer(), 'type' => type() | integer(), 'protocol' => 'default' | protocol() | integer(), 'dup' => boolean(), 'debug' => boolean(), 'use_registry' => boolean()}, Socket :: socket(), Reason :: posix() | 'domain' | 'type' | 'protocol'; (Domain :: term(), Type :: term()) -> _. -
socket:recv/3:
Lines 4840 to 4845 in 3ff36ef
-spec recv(Socket :: term(), Flags :: list(), TimeoutOrHandle :: term()) -> _; (Socket :: term(), Length :: term(), Flags :: list()) -> _; (Socket :: term(), Length :: term(), TimeoutOrHandle :: term()) -> _.
Expected behavior
Specs in OTP are well-written, are an example of best practices and conform to recommendations in documentation
Probably, there are more cases, - we encountered the quoted cases when testing our projects against OTP 27.
A current restriction, which currently results in a warning by Dialyzer, is that the domains of the argument types cannot overlap
Affected versions
OTP 27.
Additional context
Probably after #6654 dialyzer runs in OTP repro do not check for overlapping domains anymore.