Existing issue
Elixir and Erlang/OTP versions
Erlang/OTP 28 [erts-16.3] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
Elixir 1.20.0-rc.5 (862ff78) (compiled with Erlang/OTP 28)
Operating system
macos
Current behavior
the following code emits a type warning in 1.20 when @attr is an empty list.
defmodule A do
@attr Application.compile_env(:my_app, :my_key)
def foo do
with true <- :a in @attr, do: :ok
end
end
presumably due to compiler optimization, the type warning code doesn't look like the written code (simplified repro below)
iex(1)> defmodule C do
def foo do
with true <- :a in [], do: :ok
end
end
warning: the following pattern will never match:
true <-
(
_ = :a
false
)
because the right-hand side has type:
false
└─ iex:3: C.foo/0
Expected behavior
the pattern referenced should match the code to some degree to help developers know they're fixing the right bit
Existing issue
Elixir and Erlang/OTP versions
Erlang/OTP 28 [erts-16.3] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
Elixir 1.20.0-rc.5 (862ff78) (compiled with Erlang/OTP 28)
Operating system
macos
Current behavior
the following code emits a type warning in 1.20 when
@attris an empty list.presumably due to compiler optimization, the type warning code doesn't look like the written code (simplified repro below)
Expected behavior
the pattern referenced should match the code to some degree to help developers know they're fixing the right bit