Skip to content

Commit

Permalink
fix small type violation
Browse files Browse the repository at this point in the history
error:

    warning: incompatible types given to Kernel.hd/1:

        hd(__CALLER__.context_modules)

    given types:

        list(atom())

    but expected one of:

        non_empty_list(term(), term())

    typing violation found at:
    │
  3 │     module = hd(__CALLER__.context_modules)
    │              ~
    │
    └─ lib/walex/event/dsl.ex:3:14: WalEx.Event.Dsl.process_events_async/2
  • Loading branch information
DaemonSnake committed Feb 8, 2025
1 parent a8e74ff commit 7c286f0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/walex/event/dsl.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defmodule WalEx.Event.Dsl do
defmacro process_events_async(events, functions) do
module = hd(__CALLER__.context_modules)
[_ | _] = __CALLER__.context_modules
module = List.first(__CALLER__.context_modules)

quote do
Enum.each(unquote(events), fn event ->
Expand Down

0 comments on commit 7c286f0

Please sign in to comment.