Skip to content

Commit ef14f2b

Browse files
committed
WIP
1 parent b19a147 commit ef14f2b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/elixir/lib/module/types/descr.ex

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,10 @@ defmodule Module.Types.Descr do
206206
end
207207

208208
# For static types, the difference is component-wise.
209+
defp difference_static(left, :term) when not is_optional_static(left), do: none()
210+
209211
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))
211213
end
212214

213215
# Returning 0 from the callback is taken as none() for that subtype.
@@ -607,16 +609,17 @@ defmodule Module.Types.Descr do
607609

608610
defp dynamic_union(:term, other) when not is_optional_static(other), do: :term
609611
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)
611615

612616
defp dynamic_intersection(:term, other) when not is_optional_static(other), do: other
613617
defp dynamic_intersection(other, :term) when not is_optional_static(other), do: other
614618

615619
defp dynamic_intersection(left, right),
616620
do: symmetrical_intersection(unfold(left), unfold(right), &intersection/3)
617621

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)
620623

621624
defp dynamic_to_quoted(descr) do
622625
cond do

0 commit comments

Comments
 (0)