[erlang-bugs] Dialyzer's incorrect warning about opaque types
Shayan Pooya
shayan@REDACTED
Thu Sep 11 06:12:53 CEST 2014
I have these two modules:
-module(has_opaque).
-export([init/0]).
-opaque state() :: queue:queue(erlang:timestamp()).
-export_type([state/0]).
-spec init()-> state().
init() ->
queue:new().
and:
-module(use_opaque).
-export([init/0]).
-record(state, {t :: has_opaque:state()}).
init() ->
{ok, #state{t = has_opaque:init()}}.
Dialyzer is giving me this error message:
"""
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()
"""
Compilation and invoking dialyzer:
compile:
mkdir -p ebin
erlc +debug_info -o ebin/ *.erl
dialyzer:
dialyzer --get_warnings -Wno_return -Wunmatched_returns
-Werror_handling -r ebin/ --plt ~/.dialyzer_plt
I get this error happens in Erlang 17.1 and 17.2.2 (on Linux). But Erlang
R15B02 on OpenBSD did not complain.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20140911/c89f4c86/attachment.htm>
More information about the erlang-bugs
mailing list