Dialyzer confusion over equal opaque and transparent types

Dániel Szoboszlay dszoboszlay@REDACTED
Tue Feb 25 11:53:04 CET 2020


>
> all ext()s are int()s but not all int()s are ext()s.
>

This is true, ext() is declared to be a subtype of int(), so it refers to a
subset of the terms that are int()-s.

You can't pass an expression of type int() to a function that expects
> something with type ext(), because you're breaking opacity (in dialyzer's
> mind).
>

That would be true in a *different module*, but within the module where you
declare an opaque type you are allowed to break opacity. (Otherwise an
opaque type would be completely useless.)

Daniel

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200225/eb40b242/attachment.htm>


More information about the erlang-questions mailing list