Elixir and Erlang/OTP versions
Erlang/OTP 28 [erts-16.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Elixir 1.20.0-rc.4 (5d794ab) (compiled with Erlang/OTP 28)
Operating system
macOS Taohe 26.3.1
Current behavior
the following guard crash the compilation
defmodule Bug do
def do_stuff(a, b, c) when a != (b or c) do
:ok
end
end
== and and have the same behaviour
== Compilation error in file lib/bug.ex ==
** (RuntimeError) found error while checking types for Bug.do_stuff/3:
** (BadMapError) expected a map, got:
nil
The exception happened while checking this code:
def do_stuff(a, b, c) when :erlang."/="(a, :erlang.orelse(b, c)) do
:ok
end
Please report this bug at: https://github.com/elixir-lang/elixir/issues
(elixir 1.20.0-rc.4) lib/module/types/pattern.ex:1064: Module.Types.Pattern.enable_conditional_mode/1
(elixir 1.20.0-rc.4) lib/module/types/pattern.ex:1292: Module.Types.Pattern.of_remote/6
(elixir 1.20.0-rc.4) lib/module/types/pattern.ex:511: Module.Types.Pattern.of_pattern_tree/3
(elixir 1.20.0-rc.4) lib/module/types/pattern.ex:124: anonymous fn/6 in Module.Types.Pattern.of_changed_var/3
(elixir 1.20.0-rc.4) lib/enum.ex:2617: Enum."-reduce/3-lists^foldl/2-0-"/3
(elixir 1.20.0-rc.4) lib/module/types/pattern.ex:122: Module.Types.Pattern.of_changed_var/3
(elixir 1.20.0-rc.4) lib/module/types/pattern.ex:110: anonymous fn/3 in Module.Types.Pattern.of_changed_deps/4
(stdlib 7.3) maps.erl:894: :maps.fold_1/4
the following variants compile:
when a != b
when (a and not (b and c)) or (not a and (b or c))
when (a and not (b and c)) != (not a and (b or c))
Expected behavior
compilation successful
Elixir and Erlang/OTP versions
Erlang/OTP 28 [erts-16.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Elixir 1.20.0-rc.4 (5d794ab) (compiled with Erlang/OTP 28)
Operating system
macOS Taohe 26.3.1
Current behavior
the following guard crash the compilation
==andandhave the same behaviourthe following variants compile:
when a != bwhen (a and not (b and c)) or (not a and (b or c))when (a and not (b and c)) != (not a and (b or c))Expected behavior
compilation successful