[erlang-questions] Wrong advertised spec of lists:append/2
ノートン ジョーセフ ウェイ ン
Fri Mar 29 02:49:40 CET 2013
I would have expected the spec written in the lists module to have triggered a warning message.
By adding any one of these specs, dialyzer does produce the desired warning message.
%%-spec bar(list(), list()) -> list().
%%-spec bar(list(term()), list(term())) -> list(term()).
%%-spec bar([term()], [term()]) -> [term()].
bar(A, B) ->
dialyzer --plt ~/.dialyzer_plt.R16B ebin/foo.beam
Checking whether the PLT ~/.dialyzer_plt.R16B is up-to-date... yes
Proceeding with analysis...
foo.erl:10: Function baz/0 has no local return
foo.erl:11: The call foo:bar(,'a') breaks the contract ([term()],[term()]) -> [term()]
done in 0m6.70s
done (warnings were emitted)
On Mar 29, 2013, at 24:04 , Pierre Fenoll <> wrote:
> Dialyzer says it passed successfully.
> On 28 March 2013 15:38, Joseph Wayne Norton <> wrote:
> Pierre -
> Just in case ... have you tried running Dialyzer on your program? If so, what does Dialyzer report?
> Joe N.
> On Mar 28, 2013, at 11:12 PM, Pierre Fenoll <> wrote:
> > > It's not a contradiction, as kostis noted specs are not complete
> > > enumerations of all possible argument types.
> > Well, lists:append/2 asks for a list() as a second argument. Shouldn't
> > it badarg when I give it 'a', as in lists:append(, a) ?
> > _______________________________________________
> > erlang-questions mailing list
> > http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions