<div dir="ltr"><div><div><div><div>I have these two modules:<br><br>-module(has_opaque).<br>-export([init/0]).<br><br>-opaque state() :: queue:queue(erlang:timestamp()).<br>-export_type([state/0]).<br><br>-spec init()-> state().<br>init() -><br>    queue:new().<br><br><br></div>and:<br><br>-module(use_opaque).<br>-export([init/0]).<br><br>-record(state, {t :: has_opaque:state()}).<br><br>init() -><br>    {ok, #state{t = has_opaque:init()}}.<br><br><br></div>Dialyzer is giving me this error message:<br><br>"""<br>use_opaque.erl:7: The attempt to match a term of type 'undefined' | queue:queue({non_neg_integer(),non_neg_integer(),non_neg_integer()}) against the variable _ breaks the opaqueness of has_opaque:state()<br>"""<br></div><div><br></div>Compilation and invoking dialyzer:<br><br>compile:<br>        mkdir -p ebin<br>        erlc +debug_info -o ebin/ *.erl<br><br>dialyzer:<br>        dialyzer --get_warnings -Wno_return -Wunmatched_returns -Werror_handling -r ebin/ --plt ~/.dialyzer_plt<br><br><br></div>I get this error happens in Erlang 17.1 and 17.2.2 (on Linux). But Erlang R15B02 on OpenBSD did not complain.<br></div>