Existing issue
Elixir and Erlang/OTP versions
Primary repro:
Erlang/OTP 29 [erts-17.0] [source] [64-bit] [smp:28:28] [ds:28:28:10] [async-threads:1] [jit:ns]
Elixir 1.20.0-rc.5 (6050b84) (compiled with Erlang/OTP 29)
Also reproduces on OTP 28.5:
Erlang/OTP 28 [erts-16.4] [source] [64-bit] [smp:28:28] [ds:28:28:10] [async-threads:1] [jit:ns]
Elixir 1.20.0-rc.5 (6050b84) (compiled with Erlang/OTP 28)
Operating system
Debian 13 (Trixie)
Current behavior
A minimal function that creates a MapSet and immediately passes it to MapSet.member?/2 emits a Dialyzer opaque type warning on Elixir 1.20.0-rc.5.
Repro repo:
https://github.com/dkulchenko/mapset-dialyzer
Code:
defmodule Demo do
def contains?(ids, id) do
id_set = MapSet.new(ids)
MapSet.member?(id_set, id)
end
end
Steps:
git clone git@github.com:dkulchenko/mapset-dialyzer.git
cd mapset-dialyzer
mix deps.get
mix dialyzer
Dialyzer output:
lib/demo.ex:9:20:call_without_opaque
Function call without opaqueness type mismatch.
Call does not have expected term of type %MapSet{:map => :sets.set(_)} (with opaque subterms) in the 1st position.
MapSet.member?(_id_set :: %MapSet{:map => map()}, _id :: any())
This appears to be specific to Elixir 1.20 rather than Erlang/OTP 29. I verified:
Elixir 1.20.0-rc.5 / OTP 29 => reproduces
Elixir 1.20.0-rc.5 / OTP 28.5 => reproduces
Elixir 1.19.5 / OTP 28.5 => does not reproduce
Expected behavior
Dialyzer should accept the value returned by MapSet.new/1 as a valid MapSet.t() when passed to MapSet.member?/2, as it did on Elixir 1.19.5.
Existing issue
Elixir and Erlang/OTP versions
Primary repro:
Erlang/OTP 29 [erts-17.0] [source] [64-bit] [smp:28:28] [ds:28:28:10] [async-threads:1] [jit:ns]
Elixir 1.20.0-rc.5 (6050b84) (compiled with Erlang/OTP 29)
Also reproduces on OTP 28.5:
Erlang/OTP 28 [erts-16.4] [source] [64-bit] [smp:28:28] [ds:28:28:10] [async-threads:1] [jit:ns]
Elixir 1.20.0-rc.5 (6050b84) (compiled with Erlang/OTP 28)
Operating system
Debian 13 (Trixie)
Current behavior
A minimal function that creates a MapSet and immediately passes it to MapSet.member?/2 emits a Dialyzer opaque type warning on Elixir 1.20.0-rc.5.
Repro repo:
https://github.com/dkulchenko/mapset-dialyzer
Code:
Steps:
Dialyzer output:
This appears to be specific to Elixir 1.20 rather than Erlang/OTP 29. I verified:
Elixir 1.20.0-rc.5 / OTP 29 => reproduces
Elixir 1.20.0-rc.5 / OTP 28.5 => reproduces
Elixir 1.19.5 / OTP 28.5 => does not reproduce
Expected behavior
Dialyzer should accept the value returned by MapSet.new/1 as a valid MapSet.t() when passed to MapSet.member?/2, as it did on Elixir 1.19.5.