@@ -206,8 +206,10 @@ defmodule Module.Types.Descr do
206
206
end
207
207
208
208
# For static types, the difference is component-wise.
209
+ defp difference_static ( left , :term ) when not is_optional_static ( left ) , do: none ( )
210
+
209
211
defp difference_static ( left , right ) do
210
- iterator_difference ( :maps . next ( :maps . iterator ( right ) ) , left )
212
+ iterator_difference ( :maps . next ( :maps . iterator ( unfold ( right ) ) ) , unfold ( left ) )
211
213
end
212
214
213
215
# Returning 0 from the callback is taken as none() for that subtype.
@@ -607,16 +609,17 @@ defmodule Module.Types.Descr do
607
609
608
610
defp dynamic_union ( :term , other ) when not is_optional_static ( other ) , do: :term
609
611
defp dynamic_union ( other , :term ) when not is_optional_static ( other ) , do: :term
610
- defp dynamic_union ( left , right ) , do: symmetrical_merge ( unfold ( left ) , unfold ( right ) , & union / 3 )
612
+
613
+ defp dynamic_union ( left , right ) ,
614
+ do: symmetrical_merge ( unfold ( left ) , unfold ( right ) , & union / 3 )
611
615
612
616
defp dynamic_intersection ( :term , other ) when not is_optional_static ( other ) , do: other
613
617
defp dynamic_intersection ( other , :term ) when not is_optional_static ( other ) , do: other
614
618
615
619
defp dynamic_intersection ( left , right ) ,
616
620
do: symmetrical_intersection ( unfold ( left ) , unfold ( right ) , & intersection / 3 )
617
621
618
- defp dynamic_difference ( left , :term ) when not is_optional_static ( left ) , do: % { }
619
- defp dynamic_difference ( left , right ) , do: difference_static ( unfold ( left ) , unfold ( right ) )
622
+ defp dynamic_difference ( left , right ) , do: difference_static ( left , right )
620
623
621
624
defp dynamic_to_quoted ( descr ) do
622
625
cond do
0 commit comments