[erlang-bugs] nocatch error in dialyzer, R14A

Nico Kruber kruber@REDACTED
Thu Sep 2 09:57:32 CEST 2010


On Tuesday 31 August 2010 16:00:28 Kostis Sagonas wrote:
> Nico Kruber wrote:
> > On Tuesday 31 August 2010 14:59:02 Nico Kruber wrote:
> >> While I was trying to make a minimal example for another strange
> >> behaviour of the dialyzer I found the following bug calling
> >> 
> >>> dialyzer -Werror_handling -Wrace_conditions --src -c rec*.erl
> >>> --no_native
> >> 
> >> with the attached files in the current directory:
> >>   Checking whether the PLT /home/nico/.dialyzer_plt is up-to-date... yes
> >>   Proceeding with analysis...
> >> 
> >> =ERROR REPORT==== 31-Aug-2010::14:53:04 ===
> >> Error in process <0.29.0> with exit value: {{nocatch,{error,
> >> [73,108,108,101,103,97,108,32,100,101,99,108,97,114,97,116,105,111,110,3
> >> 2,1 11,102,32,"rec2",35,123,"id",125,10]}},
> >> [{erl_types,record_from_form,5},{erl_types,t_from_form,3},{erl_types,'-
> >> t_opaque_from_records/1-anonymous-2-',3},{dict,map_bucket,2},
> >> {dict,map_bkt_list,2},{dict...
> >> 
> >> 
> >> dialyzer: Analysis failed with error: {{nocatch,{error,
> >> [73,108,108,101,103,97|...]}},
> >> 
> >>  [{erl_types,record_from_form,5},
> >>  
> >>   {erl_types,t_from_form,3},
> >>   {erl_types,'-t_opaque_from_records/1-anonymous-2-',3},
> >>   {dict,map_bucket,2},
> >>   {dict,map_bkt_list,2},
> >>   {dict,map_bkt_list,2},
> >>   {dict,map_seg_list,...},
> >>   {dict,...}]}
> >> 
> >> Last messages in the log cache:
> >>   Reading files and computing callgraph... done in 0.06 secs
> >>   Removing edges... done in 0.01 secs
> >>   Typesig analysis for SCC: [{rec2,module_info,1}]
> > 
> > I forgot to mention that if you replace opaque with type in rec2.erl, it
> > works
> 
> Same issue here with the other one.  Simply change the declaration:
> 
> -record(rec2, {id :: rec1:rec1()}).
> -opaque(rec2() :: #rec2{id :: rec1:rec1()}).
> 
> to the equivalent ones:
> 
> -record(rec2, {id :: rec1:rec1()}).
> -opaque(rec2() :: #rec2{}).

same here: those are not equivalent since 
-opaque(rec2() :: #rec2{}).
will be silently expanded to 
-opaque(rec2() :: #rec2{id :: 'undefined' | rec1:rec1()}).
since there is no initialiser in the record's field definition.
The definition I provided yields to the expected behaviour, i.e. without the 
'undefined' atom.
see http://www.erlang.org/doc/reference_manual/typespec.html#id2272601


Nico
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20100902/2a571af4/attachment.bin>


More information about the erlang-bugs mailing list