Skip to content

Commit f9ebeaa

Browse files
committed
Make leaf intersection recursive
1 parent 6ce5044 commit f9ebeaa

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5014,15 +5014,23 @@ defmodule Module.Types.Descr do
50145014
#
50155015
# Which is equivalent to:
50165016
#
5017-
# (a1 and B2) or (B2 and (U2 or not a1 and D2))
5017+
# (a1 and B2) or (B2 and U2) or (B2 and not a1 and D2)
50185018
defp bdd_intersection({leaf, :bdd_top, u, d}, bdd, leaf_intersection) do
50195019
bdd_leaf_intersection(leaf, bdd, leaf_intersection)
5020-
|> bdd_union(bdd_intersection(bdd, {leaf, :bdd_bot, u, d}))
5020+
|> bdd_union(bdd_intersection(u, bdd, leaf_intersection))
5021+
|> case do
5022+
result when d == :bdd_bot -> result
5023+
result -> bdd_union(result, bdd_intersection(bdd, {leaf, :bdd_bot, :bdd_bot, d}))
5024+
end
50215025
end
50225026

50235027
defp bdd_intersection(bdd, {leaf, :bdd_top, u, d}, leaf_intersection) do
50245028
bdd_leaf_intersection(leaf, bdd, leaf_intersection)
5025-
|> bdd_union(bdd_intersection(bdd, {leaf, :bdd_bot, u, d}))
5029+
|> bdd_union(bdd_intersection(u, bdd, leaf_intersection))
5030+
|> case do
5031+
result when d == :bdd_bot -> result
5032+
result -> bdd_union(result, bdd_intersection(bdd, {leaf, :bdd_bot, :bdd_bot, d}))
5033+
end
50265034
end
50275035

50285036
defp bdd_intersection(bdd1, bdd2, _leaf_intersection) do

0 commit comments

Comments
 (0)