Dialyzer's incorrect warning about opaque types
Shayan Pooya <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.bugs |
|---|---|
| Message-ID | <CABAubTgJrC8TC9fzQ7sdswMj2cOLMeRVxkjqCx_n3jgsaQYFLg@mail.gmail.com> |
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.
_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs