elixir icon indicating copy to clipboard operation
elixir copied to clipboard

Failure during type-checking Cowboy shutdown

Open ivanopagano opened this issue 5 months ago • 1 comments

Elixir and Erlang/OTP versions

Erlang/OTP 25 [erts-13.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit]

Elixir 1.14.2 (compiled with Erlang/OTP 25)

Operating system

macos, but running mix inside a ubuntu container

Current behavior

While running

mix compile

on a phoenix project, the type-checker issues the following error

Compiling 40 files (.ex)
** (EXIT from #PID<0.96.0>) an exception was raised:
    ** (Module.Types.Error) found error while checking types for Plug.Adapters.Cowboy.shutdown/1

def shutdown(ref) do
  case using_plug_cowboy?() do
    x when :erlang.orelse(:erlang."=:="(x, false), :erlang."=:="(x, nil)) -> warn_and_raise()
    _ -> nil
  end

  Plug.Cowboy.shutdown(ref)
end

Please report this bug: https://github.com/elixir-lang/elixir/issues

** (FunctionClauseError) no function clause matching in anonymous fn/1 in Module.ParallelChecker.cache_chunk/3
        (elixir 1.14.2) lib/module/parallel_checker.ex:400: anonymous fn({{:args, 4}, %{sig: {:infer, [{[%{dynamic: :term}, %{dynamic: :term}, %{dynamic: :term}, %{dynamic: :term}], %{dynamic: %{list: [{:term, %{bitmap: 2}, []}]}}}]}}}) in Module.ParallelChecker.cache_chunk/3
        (elixir 1.14.2) lib/enum.ex:975: Enum."-each/2-lists^foreach/1-0-"/2
        (elixir 1.14.2) lib/module/parallel_checker.ex:400: Module.ParallelChecker.cache_chunk/3
        (elixir 1.14.2) lib/module/parallel_checker.ex:330: Module.ParallelChecker.cache_from_chunk/2
        (elixir 1.14.2) lib/module/parallel_checker.ex:320: Module.ParallelChecker.cache_module/2
        (elixir 1.14.2) lib/module/types/of.ex:243: Module.Types.Of.remote/5
        (elixir 1.14.2) lib/module/types/expr.ex:397: Module.Types.Expr.of_expr/4
        (elixir 1.14.2) lib/module/types/helpers.ex:93: Module.Types.Helpers.do_map_reduce_ok/3

Expected behavior

No type-checking error was reported previously on the project, when I used it last a few months ago

ivanopagano avatar Jun 27 '25 06:06 ivanopagano

Please remove _build and deps directory and it should work. This has also been fixed in more recent Elixir versions. It is happening because you used a more recent Elixir version to compile this project. :)

josevalim avatar Jun 27 '25 08:06 josevalim

Fixed by applying the suggested remedy

ivanopagano avatar Jun 30 '25 13:06 ivanopagano