[erlang-questions] dialyzer: 'breaks the contract'

Kostis Sagonas kostis@REDACTED
Thu Jan 19 08:27:54 CET 2012


On 01/19/12 09:16, Vance Shipley wrote:
> In the gen_sctp module reference manual there are examples:
>
>     /Users/otpuser/lib/erlang/lib/kernel-2.15/doc/html/gen_sctp.html#id123111
>
> In R15B when dialyzer is run on this example it produces the warning:
>
> 	sctp_client.erl:23: The call gen_sctp:send(S::port(),Assoc::#sctp_assoc_change{},0,<<_:48>>) breaks the contract (Socket,Assoc,Stream,Data) ->  'ok' | {'error',Reason} when is_subtype(Socket,sctp_socket()), is_subtype(Assoc,#sctp_assoc_change{} | assoc_id()), is_subtype(Stream,integer()), is_subtype(Data,'binary' | iolist()), is_subtype(Reason,term())
>
> What is the problem here?

The problem is that the specs of gen_sctp:send/{3,4} have a typo.

Lines 317 and 334 in file lib/kernel/src/gen_sctp.erl should read:

	Data :: binary() | iolist(),

instead of

	Data :: binary | iolist(),

Somebody at OTP should fix this.

Kostis



More information about the erlang-questions mailing list