[erlang-patches] dialyzer: Report specs defining 'incorrect' lists as return types

Fredrik fredrik@REDACTED
Mon Dec 17 10:22:44 CET 2012


Hello Stavros!
This fails:
'small_SUITE : empty_list_infimum'
with reason:
dialyzer:format_warning failed on line 295 Reason: function_clause
On all platforms..
Please fix this, and I will re-fetch.

BR Fredrik Gustafsson
Erlang OTP Team
On 12/14/2012 10:11 AM, Stavros Aronis wrote:
> This patch enables Dialyzer to detect cases where a function has a 
> specification for a return type containing some list with elements 
> different than those Dialyzer's own algorithm can infer e.g. a 
> function specified to return [atom()] when actually [[atom()]] is 
> returned.
>
> Previously Dialyzer remained silent under normal operation, seeing 
> that these two types have the empty list as a common element, so the 
> spec was not 'completely irrelevant'.
>
> Using this patch one can find discrepancies in the specs of 
> stdlib's sys.erl and erl_scan.erl. Kostis and I are in contact with 
> the OTP team for the best way fix those as well.
>
>   git fetch git://github.com/aronisstav/otp.git 
> <http://github.com/aronisstav/otp.git> dialyzer-list-spec
>
> Regards,
>
> Stavros
>
> ---
>
> The new warnings are:
>
> sys.erl:303: Invalid type specification for function 
> sys:handle_debug/4. The success typing is ([{_,_}],_,_,_) -> [{_,_}]
> erl_scan.erl:204: Invalid type specification for function 
> erl_scan:token_info/2. The success typing is (_,'category' | 'column' 
> | 'length' | 'line' | 'location' | 'symbol' | 'text' | 
> maybe_improper_list('category' | 'column' | 'length' | 'line' | 
> 'location' | 'symbol' | 'text','category' | 'column' | 'length' | 
> 'line' | 'location' | 'symbol' | 'text' | [])) -> 'undefined' | 
> maybe_improper_list({_,_},'undefined' | [] | {_,_}) | {_,_}
> erl_scan.erl:242: Invalid type specification for function 
> erl_scan:attributes_info/2. The success typing is (_,'column' | 
> 'length' | 'line' | 'location' | 'text' | maybe_improper_list('column' 
> | 'length' | 'line' | 'location' | 'text','column' | 'length' | 'line' 
> | 'location' | 'text' | [])) -> 'undefined' | 
> maybe_improper_list({_,_},'undefined' | [] | {_,_}) | {_,_}
>
>
>
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/listinfo/erlang-patches

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20121217/5deca31c/attachment.htm>


More information about the erlang-patches mailing list