Skip to content

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

Open
@francois08

Description

@francois08

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions