Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support erlang records #80

Open
ulissesalmeida opened this issue Apr 28, 2021 · 0 comments
Open

Support erlang records #80

ulissesalmeida opened this issue Apr 28, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@ulissesalmeida
Copy link

ulissesalmeida commented Apr 28, 2021

Some Elixir libraries have references to erlang types, like Erlang records.

For example, the OpenTelemetry library has start_opts type:

https://hexdocs.pm/opentelemetry_api/OpenTelemetry.Tracer.html#t:start_opts/0

If you try to reference it and use Hammox protect, it raises an exception like this:

    The following arguments were given to Hammox.TypeEngine.match_type/2:
         # 1
         {:some_attribute, "somevallue"}
         # 2
         {:type, 116, :record, [{:atom, 116, :link}]}
     Attempted function clauses (showing 10 out of 92):
         def match_type(value, {:type, _, :union, union_types} = union) when is_list(union_types)
         def match_type(_value, {:type, _, :any, []})
         def match_type(value, {:type, _, :none, []} = type)
         def match_type(value, {:type, _, :atom, []}) when is_atom(value)
         def match_type(value, {:type, _, :atom, []} = type)
         def match_type(value, {:type, _, :map, :any}) when is_map(value)
         def match_type(value, {:type, _, :pid, []}) when is_pid(value)
         def match_type(value, {:type, _, :pid, []} = type)
         def match_type(value, {:type, _, :port, []}) when is_port(value)
         def match_type(value, {:type, _, :port, []} = type)

It would be very cool if Hammox could verify it.

@msz msz added the enhancement New feature or request label Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants