From e26604161873790c709ec1e9524e1cfd7d0911d4 Mon Sep 17 00:00:00 2001 From: goose Date: Fri, 1 Sep 2023 08:06:02 +0700 Subject: [PATCH] Use intersection type --- lib/elixir_sense/core/metadata_builder.ex | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/lib/elixir_sense/core/metadata_builder.ex b/lib/elixir_sense/core/metadata_builder.ex index 3330acee..ea262ee6 100644 --- a/lib/elixir_sense/core/metadata_builder.ex +++ b/lib/elixir_sense/core/metadata_builder.ex @@ -1690,18 +1690,7 @@ defmodule ElixirSense.Core.MetadataBuilder do defp type_information_from_guards({:and, _, [guard_l, guard_r]}, state) do left = type_information_from_guards(guard_l, state) right = type_information_from_guards(guard_r, state) - - Keyword.merge(left, right, fn _k, v1, v2 -> - case {v1, v2} do - # func my_func(x) when is_map_key(x, :a) and is_map_key(x, :b) - {{:map, fields1, _}, {:map, fields2, _}} -> - {:map, Enum.uniq_by(fields1 ++ fields2, &elem(&1, 0)), nil} - - # In case we can't merge, just pick one - _ -> - v1 - end - end) + {:intersection, [left, right]} end defp type_information_from_guards({:or, _, [guard_l, guard_r]}, state) do