You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Between 27.1.3 and 27.2 the type spec for socket:sendto/4 was changed. The updated type spec does no longer allow nowait as the value for the 4th parameter.
The implementation has not changed and based on the implementation nowait is clearly valid.
-module(sock).
-export([sendto/4]).
family({_,_,_,_}) -> inet;
family({_,_,_,_,_,_,_,_}) -> inet6.
sendto(Socket, IP, Port, Data) ->
Dest = #{family => family(IP),
addr => IP,
port => Port},
case socket:sendto(Socket, Data, Dest, nowait) of
ok -> ok;
Other ->
logger:debug("sendto(~p) failed with: ~p", [Dest, Other]),
ok
end.
Results in this error:
Line 12 Column 10: The contract socket:sendto(Socket::socket(),Data::iodata(),Dest::sockaddr(),Flags::[any()]) -> Result when Result :: 'ok' | {'ok',RestData::binary()} | {'error',Reason} | {'error',{Reason,RestData::binary()}}, Reason :: posix() | 'closed' | invalid();(Socket::socket(),Data::iodata(),Cont::select_info(),TimeoutOrHandle::dynamic()) -> Result when Result :: 'ok' | {'ok',RestData::binary()} | {'error',Reason} | {'error',{Reason,RestData::binary()}}, Reason :: posix() | 'closed' | invalid() cannot be right because the inferred return for sendto(Socket::any(),Data::any(),Dest::#{'addr':={_,_,_,_} | {_,_,_,_,_,_,_,_}, 'family':='inet' | 'inet6', 'port':=_},'nowait') on line {12,10} is any()
Used to work in 27.1
Expected behavior
Call is not reported as violating the function specification.
Affected versions
27.2
The text was updated successfully, but these errors were encountered:
Describe the bug
Between 27.1.3 and 27.2 the type spec for socket:sendto/4 was changed. The updated type spec does no longer allow
nowait
as the value for the 4th parameter.The implementation has not changed and based on the implementation
nowait
is clearly valid.These lines https://github.com/erlang/otp/blob/OTP-27.1.3/lib/kernel/src/socket.erl#L3727-L3728 from 27.1.3 have been lost in PR-8986
To Reproduce
Run dialyzer on this
Results in this error:
Used to work in 27.1
Expected behavior
Call is not reported as violating the function specification.
Affected versions
27.2
The text was updated successfully, but these errors were encountered: