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

warning: the following clause will never match: {:ok, decimal} #1353

Open
francois08 opened this issue Feb 1, 2025 · 0 comments
Open

warning: the following clause will never match: {:ok, decimal} #1353

francois08 opened this issue Feb 1, 2025 · 0 comments

Comments

@francois08
Copy link

francois08 commented Feb 1, 2025

I have absinthe-related 2 warnings when compiling. One about usage of decimal and another about absinthe_plug use of Application.get_env/2 in the module body.

mix.lock versions:

"absinthe": {:hex, :absinthe, "1.7.8",
"absinthe_plug": {:hex, :absinthe_plug, "1.5.8",
"decimal": {:hex, :decimal, "2.3.0",
==> absinthe
Compiling 1 file (.erl)
Compiling 260 files (.ex)
    warning: the following clause will never match:

        {:ok, decimal}

    because it attempts to match on the result of:

        Decimal.parse(value)

    which has type:

        dynamic(
          :error or {%Decimal{coef: :NaN or :inf, exp: integer(), sign: integer()}, binary()} or
            {%Decimal{coef: :NaN or :inf or integer(), exp: integer(), sign: integer()}, term()}
        )

    typing violation found at:

 16 │         {:ok, decimal} -> {:ok, decimal}
    │         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    └─ lib/absinthe/type/custom/decimal.ex:16: Absinthe.Type.Custom.Decimal.parse/1

Generated absinthe app
==> plug
Compiling 1 file (.erl)
Compiling 40 files (.ex)
Generated plug app
==> absinthe_plug
Compiling 18 files (.ex)
    warning: Application.get_env/2 is discouraged in the module body, use Application.compile_env/3 instead

  5 │   @config Application.get_env(:absinthe_plug, Absinthe.Plug.GraphiQL)
    │                       ~

    └─ lib/absinthe/plug/graphiql/assets.ex:5:23: Absinthe.Plug.GraphiQL.Assets (module)

Elixir version: Elixir 1.18.2 (compiled with Erlang/OTP 27)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant