From d6bd4a63da1d268a3ed1bae36896b074e7a97b5d Mon Sep 17 00:00:00 2001 From: preciz Date: Sat, 5 Sep 2026 20:19:23 +0200 Subject: [PATCH 1/2] Reuse existing tuple leaves when fusion fails Avoid rebuilding and rehashing both leaves before the fallback union. Assisted-by: Codex:GPT-6 --- lib/elixir/lib/module/types/descr.ex | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/elixir/lib/module/types/descr.ex b/lib/elixir/lib/module/types/descr.ex index fd9ee0e0118..c7c3fa24d1e 100644 --- a/lib/elixir/lib/module/types/descr.ex +++ b/lib/elixir/lib/module/types/descr.ex @@ -7029,13 +7029,10 @@ defmodule Module.Types.Descr do opt_tuple_union_literal({tag1, elements1}, {tag2, elements2}) end - defp opt_tuple_union( - bdd_leaf(tag1, elements1), - bdd_leaf(tag2, elements2) - ) do + defp opt_tuple_union(bdd_leaf(tag1, elements1) = bdd1, bdd_leaf(tag2, elements2) = bdd2) do case opt_tuple_union_literal({tag1, elements1}, {tag2, elements2}) do {tag, elements} -> bdd_leaf_new(tag, elements) - nil -> bdd_union(bdd_leaf_new(tag1, elements1), bdd_leaf_new(tag2, elements2)) + nil -> bdd_union(bdd1, bdd2) end end From 45cc43501f66f61e32c26a876becf4f48f4630ad Mon Sep 17 00:00:00 2001 From: preciz Date: Sat, 5 Sep 2026 20:44:13 +0200 Subject: [PATCH 2/2] Format opt_tuple_union across multiple lines Assisted-by: Antigravity:Gemini-3.8-Flash --- lib/elixir/lib/module/types/descr.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/elixir/lib/module/types/descr.ex b/lib/elixir/lib/module/types/descr.ex index c7c3fa24d1e..f6231bb13c5 100644 --- a/lib/elixir/lib/module/types/descr.ex +++ b/lib/elixir/lib/module/types/descr.ex @@ -7029,7 +7029,10 @@ defmodule Module.Types.Descr do opt_tuple_union_literal({tag1, elements1}, {tag2, elements2}) end - defp opt_tuple_union(bdd_leaf(tag1, elements1) = bdd1, bdd_leaf(tag2, elements2) = bdd2) do + defp opt_tuple_union( + bdd_leaf(tag1, elements1) = bdd1, + bdd_leaf(tag2, elements2) = bdd2 + ) do case opt_tuple_union_literal({tag1, elements1}, {tag2, elements2}) do {tag, elements} -> bdd_leaf_new(tag, elements) nil -> bdd_union(bdd1, bdd2)