Erlang/OTP Forums

Author Message

<  Erlang patches mailing list  ~  Dialyzer warnings for gen_stream

Guest
Posted: Mon May 31, 2010 7:57 am Reply with quote
Guest
./gen_stream.erl:305: gen_stream.erl:305: Invalid type specification
for function gen_stream:init/1. The success typing is
(#gstr_state{mod_state::'ignore' | 'undefined' | {'ok',_} | {'stop',_}
| {'ok',_,_}}) -> 'ignore' |
{'ok',#gstr_state{stream_type::'undefined' | {'behaviour',atom()} |
{'binary',binary()} |
{'file',[any()]},options::#gstr_opts{x_mfa::'undefined' |
{_,_}},procs::{pid()}}} | {'stop',_} |
{'ok',#gstr_state{stream_type::'undefined' | {'behaviour',atom()} |
{'binary',binary()} |
{'file',[any()]},options::#gstr_opts{x_mfa::'undefined' |
{_,_}},procs::{pid()}},_}

./gen_stream.erl:351: gen_stream.erl:351: The specification for
gen_stream:handle_call/3 states that the function might also return
{'stop','normal',{'gstr_state','undefined' | {'behaviour',atom()} |
{'binary',binary()} | {'file',string()},_,'end_of_stream' |
{pid()},_,non_neg_integer(),atom() | non_neg_integer(),atom() |
non_neg_integer(),_}} but the inferred return is
{'reply',{'next_block',_} | {'pct_complete',atom() | integer()} |
{'stream_pos',_} | {'stream_size',atom() | non_neg_integer()} |
{'unknown_request',_},_} | {'stop','normal','stopped',_}

./gen_stream.erl:439: gen_stream.erl:439: The pattern <Reason,
{'gstr_state', {'behaviour', Module, _ModArgs}, _, Procs, ModState, _,
_, _, _}> can never match the type <_,_>

./gen_stream.erl:462: gen_stream.erl:462: The pattern <OldVsn, State =
{'gstr_state', {'behaviour', Module, _ModArgs}, _, _, ModState, _, _,
_, _}, Extra> can never match the type <_,_,_>

./gen_stream.erl:596: gen_stream.erl:596: The pattern <{'behaviour',
Module, _ModInitArgs}, Seen, Chunk> can never match the type
<'undefined' | {'behaviour',atom()} | {'binary',binary()} |
{'file',string()},_,_>

./gen_stream.erl:627: gen_stream.erl:627: The pattern <Args =
{'gstr_args', {'behaviour', Module, _InitArgs}, SrcSize, _, _, _, _,
BlockSize, _, IsCircular, _, ModState}, ProcNums> can never match the
type <#gstr_args{stream_type::'undefined' |
{'behaviour',atom()},source_size::atom() |
non_neg_integer()},[integer()]>

./gen_stream.erl:631: gen_stream.erl:631: Function will never be called


--
Björn Gustavsson, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

Post received from mailinglist
Guest
Posted: Mon May 31, 2010 7:58 am Reply with quote
Guest
./gen_stream.erl:305: gen_stream.erl:305: Invalid type specification
for function gen_stream:init/1. The success typing is
(#gstr_state{mod_state::'ignore' | 'undefined' | {'ok',_} | {'stop',_}
| {'ok',_,_}}) -> 'ignore' |
{'ok',#gstr_state{stream_type::'undefined' | {'behaviour',atom()} |
{'binary',binary()} |
{'file',[any()]},options::#gstr_opts{x_mfa::'undefined' |
{_,_}},procs::{pid()}}} | {'stop',_} |
{'ok',#gstr_state{stream_type::'undefined' | {'behaviour',atom()} |
{'binary',binary()} |
{'file',[any()]},options::#gstr_opts{x_mfa::'undefined' |
{_,_}},procs::{pid()}},_}

./gen_stream.erl:351: gen_stream.erl:351: The specification for
gen_stream:handle_call/3 states that the function might also return
{'stop','normal',{'gstr_state','undefined' | {'behaviour',atom()} |
{'binary',binary()} | {'file',string()},_,'end_of_stream' |
{pid()},_,non_neg_integer(),atom() | non_neg_integer(),atom() |
non_neg_integer(),_}} but the inferred return is
{'reply',{'next_block',_} | {'pct_complete',atom() | integer()} |
{'stream_pos',_} | {'stream_size',atom() | non_neg_integer()} |
{'unknown_request',_},_} | {'stop','normal','stopped',_}

./gen_stream.erl:439: gen_stream.erl:439: The pattern <Reason,
{'gstr_state', {'behaviour', Module, _ModArgs}, _, Procs, ModState, _,
_, _, _}> can never match the type <_,_>

./gen_stream.erl:462: gen_stream.erl:462: The pattern <OldVsn, State =
{'gstr_state', {'behaviour', Module, _ModArgs}, _, _, ModState, _, _,
_, _}, Extra> can never match the type <_,_,_>

./gen_stream.erl:596: gen_stream.erl:596: The pattern <{'behaviour',
Module, _ModInitArgs}, Seen, Chunk> can never match the type
<'undefined' | {'behaviour',atom()} | {'binary',binary()} |
{'file',string()},_,_>

./gen_stream.erl:627: gen_stream.erl:627: The pattern <Args =
{'gstr_args', {'behaviour', Module, _InitArgs}, SrcSize, _, _, _, _,
BlockSize, _, IsCircular, _, ModState}, ProcNums> can never match the
type <#gstr_args{stream_type::'undefined' |
{'behaviour',atom()},source_size::atom() |
non_neg_integer()},[integer()]>

./gen_stream.erl:631: gen_stream.erl:631: Function will never be called


--
Björn Gustavsson, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

Post received from mailinglist
Guest
Posted: Mon May 31, 2010 10:06 am Reply with quote
Guest
Björn Gustavsson wrote:
> ....
>
> ./gen_stream.erl:439: gen_stream.erl:439: The pattern <Reason,
> {'gstr_state', {'behaviour', Module, _ModArgs}, _, Procs, ModState, _,
> _, _, _}> can never match the type <_,_>
>
> ....
>

These dialyzer warnings are correct but some of them look a bit weird.
For example, the one above should read:

gen_stream.erl:439: The pattern <Reason, {'gstr_state', {'behaviour',
Module, _ModArgs}, _, Procs, ModState, _, _, _, _}> can never match the
type <_,#gstr_state{stream_type::'undefined' | {'behaviour',atom()} |
{'binary',binary()} | {'file',string()},procs::'end_of_stream' |
{pid()},active_proc::non_neg_integer(),source_size::atom() |
non_neg_integer(),report_size::atom() | non_neg_integer()}>

and this is the one I get on my version of dialyzer.


Also, perhaps a detail, but I am not sure how the double:

./gen_stream.erl:439: gen_stream.erl:439:

prefix gets generated.

Kostis

________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

Post received from mailinglist
Guest
Posted: Mon May 31, 2010 10:06 am Reply with quote
Guest
Björn Gustavsson wrote:
> ....
>
> ./gen_stream.erl:439: gen_stream.erl:439: The pattern <Reason,
> {'gstr_state', {'behaviour', Module, _ModArgs}, _, Procs, ModState, _,
> _, _, _}> can never match the type <_,_>
>
> ....
>

These dialyzer warnings are correct but some of them look a bit weird.
For example, the one above should read:

gen_stream.erl:439: The pattern <Reason, {'gstr_state', {'behaviour',
Module, _ModArgs}, _, Procs, ModState, _, _, _, _}> can never match the
type <_,#gstr_state{stream_type::'undefined' | {'behaviour',atom()} |
{'binary',binary()} | {'file',string()},procs::'end_of_stream' |
{pid()},active_proc::non_neg_integer(),source_size::atom() |
non_neg_integer(),report_size::atom() | non_neg_integer()}>

and this is the one I get on my version of dialyzer.


Also, perhaps a detail, but I am not sure how the double:

./gen_stream.erl:439: gen_stream.erl:439:

prefix gets generated.

Kostis

________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

Post received from mailinglist
Guest
Posted: Mon May 31, 2010 10:24 am Reply with quote
Guest
2010/5/31 Kostis Sagonas <kostis@cs.ntua.gr>:

> These dialyzer warnings are correct but some of them look a bit weird.

It is dialyzer run based on the 'pu' branch, using an escript
that formats the warnings as HTML code.

--
Björn Gustavsson, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

Post received from mailinglist
Guest
Posted: Mon May 31, 2010 10:24 am Reply with quote
Guest
2010/5/31 Kostis Sagonas <kostis@cs.ntua.gr>:

> These dialyzer warnings are correct but some of them look a bit weird.

It is dialyzer run based on the 'pu' branch, using an escript
that formats the warnings as HTML code.

--
Björn Gustavsson, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

Post received from mailinglist
Guest
Posted: Mon May 31, 2010 11:44 am Reply with quote
Guest
Björn Gustavsson wrote:
> 2010/5/31 Kostis Sagonas <kostis@cs.ntua.gr>:
>
>> These dialyzer warnings are correct but some of them look a bit weird.
>
> It is dialyzer run based on the 'pu' branch, using an escript
> that formats the warnings as HTML code.

Bjorn,

The problem is that the warnings as output by the escript do not make
much sense. For example, the warning:

./gen_stream.erl:439: gen_stream.erl:439: The pattern <Reason,
{'gstr_state', {'behaviour', Module, _ModArgs}, _, Procs, ModState, _,
_, _, _}> can never match the type <_,_>

is problematic because the type contains two underscores, i.e. two any()

Instead, the vanilla dialyzer specifies some type which indeed does not
match the pattern:

gen_stream.erl:439: The pattern <Reason, {'gstr_state', {'behaviour',
Module, _ModArgs}, _, Procs, ModState, _, _, _, _}> can never match the
type <_,#gstr_state{stream_type::'undefined' | {'behaviour',atom()} |
{'binary',binary()} | {'file',string()},procs::'end_of_stream' |
{pid()},active_proc::non_neg_integer(),source_size::atom() |
non_neg_integer(),report_size::atom() | non_neg_integer()}>

the stream_type is {'behaviour',Module,_ModArgs} while the type
declaration of the #gstr_state{} record reads: {'behaviour',atom()}
(among others).

So, either the dialyzer in 'pu' or the escript needs fixing here.

Kostis

________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

Post received from mailinglist
Guest
Posted: Mon May 31, 2010 11:44 am Reply with quote
Guest
Björn Gustavsson wrote:
> 2010/5/31 Kostis Sagonas <kostis@cs.ntua.gr>:
>
>> These dialyzer warnings are correct but some of them look a bit weird.
>
> It is dialyzer run based on the 'pu' branch, using an escript
> that formats the warnings as HTML code.

Bjorn,

The problem is that the warnings as output by the escript do not make
much sense. For example, the warning:

./gen_stream.erl:439: gen_stream.erl:439: The pattern <Reason,
{'gstr_state', {'behaviour', Module, _ModArgs}, _, Procs, ModState, _,
_, _, _}> can never match the type <_,_>

is problematic because the type contains two underscores, i.e. two any()

Instead, the vanilla dialyzer specifies some type which indeed does not
match the pattern:

gen_stream.erl:439: The pattern <Reason, {'gstr_state', {'behaviour',
Module, _ModArgs}, _, Procs, ModState, _, _, _, _}> can never match the
type <_,#gstr_state{stream_type::'undefined' | {'behaviour',atom()} |
{'binary',binary()} | {'file',string()},procs::'end_of_stream' |
{pid()},active_proc::non_neg_integer(),source_size::atom() |
non_neg_integer(),report_size::atom() | non_neg_integer()}>

the stream_type is {'behaviour',Module,_ModArgs} while the type
declaration of the #gstr_state{} record reads: {'behaviour',atom()}
(among others).

So, either the dialyzer in 'pu' or the escript needs fixing here.

Kostis

________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

Post received from mailinglist
Guest
Posted: Mon May 31, 2010 12:15 pm Reply with quote
Guest
2010/5/31 Kostis Sagonas <kostis@cs.ntua.gr>:
> Björn Gustavsson wrote:
>>
>> 2010/5/31 Kostis Sagonas <kostis@cs.ntua.gr>:
>>
>>> These dialyzer warnings are correct but some of them look a bit weird.
>>
>> It is dialyzer run based on the 'pu' branch, using an escript
>> that formats the warnings as HTML code.
>
> Bjorn,
>
> The problem is that the warnings as output by the escript do not make much
> sense. For example, the warning:

Yes, I got that. I have done some further investigation. Since the details
are probably not interesting for this mailing, I'll send them in a separate
email off-list.

--
Björn Gustavsson, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

Post received from mailinglist
Guest
Posted: Mon May 31, 2010 12:16 pm Reply with quote
Guest
2010/5/31 Kostis Sagonas <kostis@cs.ntua.gr>:
> Björn Gustavsson wrote:
>>
>> 2010/5/31 Kostis Sagonas <kostis@cs.ntua.gr>:
>>
>>> These dialyzer warnings are correct but some of them look a bit weird.
>>
>> It is dialyzer run based on the 'pu' branch, using an escript
>> that formats the warnings as HTML code.
>
> Bjorn,
>
> The problem is that the warnings as output by the escript do not make much
> sense. For example, the warning:

Yes, I got that. I have done some further investigation. Since the details
are probably not interesting for this mailing, I'll send them in a separate
email off-list.

--
Björn Gustavsson, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

Post received from mailinglist
jay
Posted: Wed Jun 02, 2010 6:31 am Reply with quote
User Joined: 06 Sep 2006 Posts: 139 Location: Los Angeles, CA USA
Fixed.

git fetch git://github.com/jaynel/otp.git jn/gen_stream



________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

Post received from mailinglist
View user's profile Send private message Visit poster's website
jay
Posted: Wed Jun 02, 2010 6:31 am Reply with quote
User Joined: 06 Sep 2006 Posts: 139 Location: Los Angeles, CA USA
Fixed.

git fetch git://github.com/jaynel/otp.git jn/gen_stream



________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

Post received from mailinglist
View user's profile Send private message Visit poster's website
Guest
Posted: Wed Jun 02, 2010 7:03 am Reply with quote
Guest
On Tue, Jun 01, 2010 at 10:32:30PM -0700, Jay Nelson wrote:
> Fixed.
>
> git fetch git://github.com/jaynel/otp.git jn/gen_stream

Great! 'pu' will be updated.

>
>
>
> ________________________________________________________________
> erlang-patches (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

Post received from mailinglist
Guest
Posted: Wed Jun 02, 2010 7:03 am Reply with quote
Guest
On Tue, Jun 01, 2010 at 10:32:30PM -0700, Jay Nelson wrote:
> Fixed.
>
> git fetch git://github.com/jaynel/otp.git jn/gen_stream

Great! 'pu' will be updated.

>
>
>
> ________________________________________________________________
> erlang-patches (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-patches (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-patches-unsubscribe@erlang.org

Post received from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum