Skip to content

Conversation

@gldubc
Copy link
Member

@gldubc gldubc commented Nov 24, 2025

No description provided.

[
if((bitmap &&& @bit_binary) != 0, do: domain_key(:binary)),
if((bitmap &&& @bit_empty_list) != 0, do: domain_key(:empty_list)),
if((bitmap &&& @bit_empty_list) != 0, do: domain_key(:list)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we can include :list twice. I think we need to handle that a bit upstream. :S

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this gets handled gracefully thanks to

  # TODO: Double check if we indeed want the union here
  # when we start using domain types from Elixir itself
  defp map_put_domain(domain, key, value) do
    Map.update(domain, key, if_set(value), &union(&1, value))
  end

So when we instantiate say, empty_list() to integer() and non_empty_list() to atom() from Elixir, this will be split into two pairs of bindings passed to the constructor closed_map or open_map, with twice the same key domain_key(:list). Then, the map will have :list bound to integer() or atom(). I just added a test for that. A typing test would be nice too perhaps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants