[erlang-questions] Is it possible to have nested parametrised types when the base type is opaque?

James Fish james@REDACTED
Thu Dec 18 16:32:28 CET 2014


Hi all,

I am never one to doubt that dialyzer is correct, and I am wrong. In this
case I am perplexed by the warning generated with nested parametrised
types. For example if a module defines the type:

-type myqueue(Item) :: {myqueue, queue:queue({integer(), Item})}.

And another module wishes to use myqueue/1:

-spec in(integer(), myqueue(integer()) -> myqueue(integer()).

Dialyzer will warn that success typing has the second argument and result
of the form {myqueue, queue:queue({integer(), any()})}. What is the
subtlety that I am missing?

You can find two sample modules attached. One module with a parametrised
queue and another with a parametrised "parametrised" queue using the first
module. Dialyzer has alot of fun with the second module. If queue:queue()
was not opaque no warnings are generated and if myqueue:myqueue() is not
opaque an extra warning is generated.

Thank you,

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20141218/ad9606c0/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myqueue.erl
Type: text/x-erlang
Size: 415 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20141218/ad9606c0/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myqueue_params.erl
Type: text/x-erlang
Size: 521 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20141218/ad9606c0/attachment-0001.bin>


More information about the erlang-questions mailing list