Skip to content

Commit

Permalink
Catch future Dialyzer warnings on context in module attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
g-andrade committed Nov 4, 2023
1 parent 8493ba9 commit 34acc8b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/extra/context_in_attribute_passes_dialyzer.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
defmodule SqidsTest.Extra.ContextInAttributePassesDialyzer do
@moduledoc false

import Sqids.Hacks, only: [dialyzed_ctx: 1]

@context Sqids.new!()

@spec encode!([non_neg_integer]) :: String.t()
def encode!(numbers), do: Sqids.encode!(dialyzed_ctx(@context), numbers)

@spec decode!(String.t()) :: [non_neg_integer]
def decode!(id), do: Sqids.decode!(dialyzed_ctx(@context), id)
end

0 comments on commit 34acc8b

Please sign in to comment.