<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">I am trying to do some exercises on opaque type, the dialyzer should report error on below code, but it does not.</div><div class=""><br class=""></div><div class=""><span style="font-family: Menlo; font-size: 11px; background-color: rgb(255, 255, 255);" class="">%% opaque1.erl</span></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #7d7ca6" class="">-module</span><span style="font-variant-ligatures: no-common-ligatures" class="">(opaque1).</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(125, 124, 166); background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">-export_type</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">([</span><span style="font-variant-ligatures: no-common-ligatures; color: #34a327" class="">test_text/0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">]).</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #7d7ca6" class="">-opaque</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #34a327" class="">test_text</span><span style="font-variant-ligatures: no-common-ligatures" class="">() :: [{</span><span style="font-variant-ligatures: no-common-ligatures; color: #7d7ca6" class="">atom</span><span style="font-variant-ligatures: no-common-ligatures" class="">(), </span><span style="font-variant-ligatures: no-common-ligatures; color: #7d7ca6" class="">number</span><span style="font-variant-ligatures: no-common-ligatures" class="">()}].</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 163, 39); background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #7d7ca6" class="">-export</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">([</span><span style="font-variant-ligatures: no-common-ligatures" class="">make_text/0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">]).</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(52, 163, 39); background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #7d7ca6" class="">-spec</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">make_text</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">() -></span><span style="font-variant-ligatures: no-common-ligatures; color: #5e34ff" class=""> </span><span style="font-variant-ligatures: no-common-ligatures" class="">test_text</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">().</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255); min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(94, 52, 255); background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">make_text</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">() -></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> [{a,1}, {c,3}].</span></div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">%% opaque2.erl</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #7d7ca6" class="">-module</span><span style="font-variant-ligatures: no-common-ligatures" class="">(opaque2).</span></div><div style="margin: 0px; line-height: normal; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal; color: rgb(125, 124, 166);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">-export</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">([</span><span style="font-variant-ligatures: no-common-ligatures; color: #34a327" class="">test/0</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">]).</span></div><div style="margin: 0px; line-height: normal; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #5e34ff" class="">test</span><span style="font-variant-ligatures: no-common-ligatures" class="">() -></span></div><div style="margin: 0px; line-height: normal; color: rgb(52, 163, 39);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #cd7923" class="">X</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> = </span><span style="font-variant-ligatures: no-common-ligatures" class="">opaque1</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">:</span><span style="font-variant-ligatures: no-common-ligatures" class="">make_text</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(),</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> [</span><span style="font-variant-ligatures: no-common-ligatures; color: #cd7923" class="">F</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #d03bff" class="">||</span><span style="font-variant-ligatures: no-common-ligatures" class=""> {</span><span style="font-variant-ligatures: no-common-ligatures; color: #cd7923" class="">F</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #cd7923" class="">_</span><span style="font-variant-ligatures: no-common-ligatures" class="">} </span><span style="font-variant-ligatures: no-common-ligatures; color: #d03bff" class=""><-</span><span style="font-variant-ligatures: no-common-ligatures" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #cd7923" class="">X</span><span style="font-variant-ligatures: no-common-ligatures" class="">]. % This violates the abstraction of opaque type from module opaque1.</span></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">Run dialyzer on these two modules will produce:</div><div style="margin: 0px; line-height: normal;" class="">%%%%</div><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">MacBookPro:dialyzer by$ dialyzer opaque1.erl </span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> Checking whether the PLT /Users/by/.dialyzer_plt is up-to-date... yes</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> Proceeding with analysis... done in 0m0.12s</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">done (passed successfully)</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">MacBookPro:dialyzer by$ </span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">%%%%</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">%%%%</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">MacBookPro:dialyzer by$ dialyzer opaque2.erl </span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> Checking whether the PLT /Users/by/.dialyzer_plt is up-to-date... yes</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> Proceeding with analysis...</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Unknown functions:</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> opaque1:make_text/0</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""> done in 0m0.13s</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">done (passed successfully)</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">MacBookPro:dialyzer by$ </span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">%%%%</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">My Erlang/OTP version is: OTP-22.1.4</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">Am I missing something?</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; line-height: normal;" class="">Kind Regards,</div><div style="margin: 0px; line-height: normal;" class="">Yao</div></span></div></div></span></div></body></html>