<div dir="ltr"><div>Thanks Hans,<br><br>I worked around this issue in the code to let it work on both Erl 17 and the previous versions:<br><a href="https://github.com/discoproject/disco/commit/b4e1d4d723e0bd8ae1a61827d62c5643e8aa9e5d">https://github.com/discoproject/disco/commit/b4e1d4d723e0bd8ae1a61827d62c5643e8aa9e5d</a><br>
<br></div>In the near future, I am going to use the method deployed by meck to remove this nowarn option:<br>-ifdef(namespaced_types).<br>-type disco_dict() :: dict:dict().<br>-type disco_gbtree() :: gb_trees:tree().<br>-type disco_gbtree(K, V) :: gb_trees:tree(K, V).<br>
-type disco_gbset() :: gb_sets:set().<br>-type disco_gbset(K) :: gb_sets:set(K).<br>-type disco_queue() :: queue:queue().<br>-else.<br>-type disco_dict() :: dict().<br>-type disco_gbtree() :: gb_tree().<br>-type disco_gbtree(_,_) :: gb_tree().<br>
-type disco_gbset() :: gb_set().<br>-type disco_gbset(_) :: gb_set().<br>-type disco_queue() :: queue().<br>-endif.<br><br><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 16, 2014 at 5:49 AM, Hans Bolinder <span dir="ltr"><<a href="mailto:hans.bolinder@ericsson.com" target="_blank">hans.bolinder@ericsson.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">




<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">Hi,<br>
<br>
[Shayan Pooya:]<div class=""><br>
> In order to make Disco compile with Erlang 17 without warnings, I<br>
> added nowarn_deprecated_type to silence the warnings. However, after<br>
> doing so, dialyzer fails with the following error:<br>
><br>
> ddfs_master.erl:345: Attempt to test for inequality between a term of type 'false' and a term of opaque type 'false' | gb_set()<br>
<br></div>
This is a bug. There will be a fix in 17.1. You can<br>
try the patch below, or run Dialyzer with the "-Wno_opaque" option.<br>
<br>
Best regards,<br>
<br>
Hans Bolinder, Erlang/OTP team, Ericsson<br>
<br>
diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl<br>
index 47b8dc7..6065b79 100644<br>
--- a/lib/hipe/cerl/erl_types.erl<br>
+++ b/lib/hipe/cerl/erl_types.erl<br>
@@ -2985,16 +2985,19 @@ inf_union(U1, U2, Opaques) -><br>
         List = [A,B,F,I,L,N,T,M,Map],<br>
         inf_union_collect(List, Opaque, InfFun, [], [])<br>
     end,<br>
-  O1 = OpaqueFun(U1, U2, fun(E, Opaque) -> t_inf(Opaque, E, Opaques) end),<br>
-  O2 = OpaqueFun(U2, U1, fun(E, Opaque) -> t_inf(E, Opaque, Opaques) end),<br>
-  Union = inf_union(U1, U2, 0, [], Opaques),<br>
-  t_sup([O1, O2, Union]).<br>
+  {O1, ThrowList1} =<br>
+    OpaqueFun(U1, U2, fun(E, Opaque) -> t_inf(Opaque, E, Opaques) end),<br>
+  {O2, ThrowList2}<br>
+    = OpaqueFun(U2, U1, fun(E, Opaque) -> t_inf(E, Opaque, Opaques) end),<br>
+  {Union, ThrowList3} = inf_union(U1, U2, 0, [], [], Opaques),<br>
+  ThrowList = lists:merge3(ThrowList1, ThrowList2, ThrowList3),<br>
+  case t_sup([O1, O2, Union]) of<br>
+    ?none when ThrowList =/= [] -> throw(hd(ThrowList));<br>
+    Sup -> Sup<br>
+  end.<br>
 <br>
 inf_union_collect([], _Opaque, _InfFun, InfList, ThrowList) -><br>
-  case t_sup(InfList) of<br>
-    ?none when ThrowList =/= [] -> throw(hd(lists:flatten(ThrowList)));<br>
-    Sup -> Sup<br>
-  end;<br>
+  {t_sup(InfList), lists:usort(ThrowList)};<br>
 inf_union_collect([?none|L], Opaque, InfFun, InfList, ThrowList) -><br>
   inf_union_collect(L, Opaque, InfFun, [?none|InfList], ThrowList);<br>
 inf_union_collect([E|L], Opaque, InfFun, InfList, ThrowList) -><br>
@@ -3005,19 +3008,21 @@ inf_union_collect([E|L], Opaque, InfFun, InfList, ThrowList) -><br>
       inf_union_collect(L, Opaque, InfFun, InfList, [N|ThrowList])<br>
   end.<br>
 <br>
-inf_union([?none|Left1], [?none|Left2], N, Acc, Opaques) -><br>
-  inf_union(Left1, Left2, N, [?none|Acc], Opaques);<br>
-inf_union([T1|Left1], [T2|Left2], N, Acc, Opaques) -><br>
-  case t_inf(T1, T2, Opaques) of<br>
-    ?none -> inf_union(Left1, Left2, N, [?none|Acc], Opaques);<br>
-    T     -> inf_union(Left1, Left2, N+1, [T|Acc], Opaques)<br>
+inf_union([?none|Left1], [?none|Left2], N, Acc, ThrowList, Opaques) -><br>
+  inf_union(Left1, Left2, N, [?none|Acc], ThrowList, Opaques);<br>
+inf_union([T1|Left1], [T2|Left2], N, Acc, ThrowList, Opaques) -><br>
+  try t_inf(T1, T2, Opaques) of<br>
+    ?none -> inf_union(Left1, Left2, N, [?none|Acc], ThrowList, Opaques);<br>
+    T     -> inf_union(Left1, Left2, N+1, [T|Acc], ThrowList, Opaques)<br>
+  catch throw:N when is_integer(N) -><br>
+      inf_union(Left1, Left2, N, [?none|Acc], [N|ThrowList], Opaques)<br>
   end;<br>
-inf_union([], [], N, Acc, _Opaques) -><br>
-  if N =:= 0 -> ?none;<br>
+inf_union([], [], N, Acc, ThrowList, _Opaques) -><br>
+  if N =:= 0 -> {?none, ThrowList};<br>
      N =:= 1 -><br>
       [Type] = [T || T <- Acc, T =/= ?none],<br>
-      Type;<br>
-     N >= 2  -> ?union(lists:reverse(Acc))<br>
+      {Type, ThrowList};<br>
+     N >= 2  -> {?union(lists:reverse(Acc)), ThrowList}<br>
   end.<br>
 <br>
 inf_bitstr(U1, B1, U2, B2) -><br>
<br>
</div>
</div>

<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>