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] [dtrace]
Elixir 1.20.0-rc.3 (5979c42) (compiled with Erlang/OTP 28)
Operating system
MacOS
Current behavior
defmodule Bug do
def foo(x, m) when not :erlang.map_get(x, m) do
:ok
end
end
warning: incompatible types given to Kernel.not/1:
not :erlang.map_get(x, m)
given types:
not boolean() or boolean()
but expected one of:
#1
true
#2
false
where "m" was given the type:
# type: map()
# from: bug.ex:2:36
:erlang.map_get(x, m)
type warning found at:
│
2 │ def foo(x, m) when not :erlang.map_get(x, m) do
│ ~
│
└─ bug.ex:2:24: Bug.foo/2
Expected behavior
No type error.
Bug.foo(:key, %{key: false}) is a valid input
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] [dtrace]
Elixir 1.20.0-rc.3 (5979c42) (compiled with Erlang/OTP 28)
Operating system
MacOS
Current behavior
Expected behavior
No type error.
Bug.foo(:key, %{key: false})is a valid input