[erlang-questions] Polymorphic opaque types and dialyzer

Siraaj Khandkar siraaj@REDACTED
Mon Jul 7 21:12:04 CEST 2014


On 07/07/2014 09:18 AM, Luca Favatella wrote:
>> Any update on this? Any plans for Dialyzer to ever support polymorphic
>> opaque types?
>
> Hi Siraaj,
>
> With OTP 17.1 your example gives me "done (passed successfully)". Have you tried retesting it?
>
> $ dialyzer --src opaque.erl --plt [...]
>    Checking whether the PLT [...] is up-to-date... yes
>    Proceeding with analysis... done in 0m1.69s
> done (passed successfully)
>
> (The exit status is 0)
>
> $ cat opaque.erl
> -module(opaque).
> -opaque test(A) :: {A, A}.
>

Hi Luca,

I only tried with R16B02 before. Just tried with 17.1.1 and it does 
indeed work. Awesome! Thanks!

My test case:

     $ cat foo.erl
     -module(foo).

     -export_type([t/1]).

     -record(t, {bar}).

     -opaque t(A) :: #t{bar :: A}.

     $ erlc +debug_info foo.erl

     $ dialyzer foo.beam
       Checking whether the PLT /home/siraaj/.dialyzer_plt is 
up-to-date... yes
       Proceeding with analysis... done in 0m6.04s
     done (passed successfully)


>
>
>> On 03/13/2012 08:38 AM, Dmitry Groshev wrote:
>>> Dialyzer can't handle polymorphic opaque type:
>>>
>>> $ echo "-module(opaque)." >> opaque.erl
>>> $ echo "-opaque test(A) :: {A, A}." >> opaque.erl
>>> $ dialyzer --src opaque.erl
>>>     Checking whether the PLT
>>> /home/si14/work/repos/saelmon/.saelmon_dialyzer.plt is up-to-date...
>>> yes
>>>     Proceeding with analysis...
>>> =ERROR REPORT==== 13-Mar-2012::16:32:50 ===
>>> Error in process <0.30.0> with exit value:
>>> {{nocatch,{error,"Polymorphic opaque types not supported
>>> yet"}},[{erl_types,'-t_opaque_from_records/1-anonymous-2-',3,[{file,"erl_types.erl"},{line,564}]},{dict,map_bucket,2,[{file,"dict.erl"},{line,459}]},{dict,map_bkt_list,2,...
>>>
>>>
>>> dialyzer: Analysis failed with error:
>>> {{nocatch,{error,"Polymorphic opaque types not supported yet"}},
>>>    [{erl_types,'-t_opaque_from_records/1-anonymous-2-',3,
>>>                [{file,"erl_types.erl"},{line,564}]},
>>>     {dict,map_bucket,2,[{file,[...]},{line,...}]},
>>>     {dict,map_bkt_list,2,[{file,...},{...}]},
>>>     {dict,map_bkt_list,2,[{...}|...]},
>>>     {dict,map_seg_list,2,[...]},
>>>     {dict,map_dict,2,...},
>>>     {erl_types,t_opaque_from_records,...},
>>>     {dialyzer_typesig,...}]}
>>> 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: [{opaque,module_info,0}]
>>>
>>> Is there any solution to this? Will it be fixed in upcoming releases of
>>> Erlang?
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list