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

James Fish <>
Thu Dec 18 16:52:57 CET 2014


I forgot to mention this is on 17.3 and 17.4 (note the queue:queue/1 type
in the sample modules).

On 18 December 2014 at 15:32, James Fish <> wrote:
>
> 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/0adf97cc/attachment.html>


More information about the erlang-questions mailing list