Dialyzer does not report errors when module having abstraction violation on opaque type.
by
by@REDACTED
Sat Dec 28 08:25:59 CET 2019
Hi,
I am trying to do some exercises on opaque type, the dialyzer should report error on below code, but it does not.
%% opaque1.erl
-module(opaque1).
-export_type([test_text/0]).
-opaque test_text() :: [{atom(), number()}].
-export([make_text/0]).
-spec make_text() -> test_text().
make_text() ->
[{a,1}, {c,3}].
%% opaque2.erl
-module(opaque2).
-export([test/0]).
test() ->
X = opaque1:make_text(),
[F || {F, _} <- X]. % This violates the abstraction of opaque type from module opaque1.
Run dialyzer on these two modules will produce:
%%%%
MacBookPro:dialyzer by$ dialyzer opaque1.erl
Checking whether the PLT /Users/by/.dialyzer_plt is up-to-date... yes
Proceeding with analysis... done in 0m0.12s
done (passed successfully)
MacBookPro:dialyzer by$
%%%%
%%%%
MacBookPro:dialyzer by$ dialyzer opaque2.erl
Checking whether the PLT /Users/by/.dialyzer_plt is up-to-date... yes
Proceeding with analysis...
Unknown functions:
opaque1:make_text/0
done in 0m0.13s
done (passed successfully)
MacBookPro:dialyzer by$
%%%%
My Erlang/OTP version is: OTP-22.1.4
Am I missing something?
Kind Regards,
Yao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20191228/6bbf93d1/attachment.htm>
More information about the erlang-questions
mailing list