Existing issue
Elixir and Erlang/OTP versions
Erlang/OTP 28 [erts-16.4.0.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]
Interactive Elixir (1.21.0-dev)
Operating system
any
Current behavior
compatible_intersection/2 doc states
Returns the intersection between two types only if they are compatible. Otherwise returns :error.
yet compatible_intersection(other, :term) shortcut does not check compatibility
Repro:
compatible?(none(), term())
false # correct
compatible?(dynamic(none()), term())
false # correct
compatible_intersection(none(), term())
{:ok, %{}} # wrong, expected error
compatible_intersection(dynamic(none()), term())
{:ok, %{dynamic: %{}}} # wrong, expected error
The bug currently has no impact on real code. The only caller is
|
case gradual?(old_type) and compatible_intersection(old_type, type) do |
where
gradual?(old_type) and
ew_type != old_type effectively nullify it.
Expected behavior
Error returned
Existing issue
Elixir and Erlang/OTP versions
Erlang/OTP 28 [erts-16.4.0.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]
Interactive Elixir (1.21.0-dev)
Operating system
any
Current behavior
compatible_intersection/2doc statesyet
compatible_intersection(other, :term)shortcut does not check compatibilityRepro:
The bug currently has no impact on real code. The only caller is
elixir/lib/elixir/lib/module/types/of.ex
Line 140 in 4215bbe
where
gradual?(old_type)andew_type != old_typeeffectively nullify it.Expected behavior
Error returned