Skip to content

Conversation

josevalim
Copy link
Member

No description provided.

@josevalim josevalim merged commit 20564ba into main Oct 2, 2025
26 checks passed
@josevalim josevalim deleted the all-lazy-bdd branch October 2, 2025 17:30
@josevalim
Copy link
Member Author

💚 💙 💜 💛 ❤️

@sabiwara
Copy link
Contributor

sabiwara commented Oct 3, 2025

I found an issue when trying this out, here is a repro:

Mix.install([:stream_data])

defmodule BrokenBDD do
  def type() do
    StreamData.one_of([StreamData.integer(), StreamData.binary()])
  end
end
** (EXIT from #PID<0.101.0>) an exception was raised:
    ** (RuntimeError) found error while checking types for BrokenBDD.type/0:

** (FunctionClauseError) no function clause matching in Module.Types.Descr.bdd_to_dnf/4
The exception happened while checking this code:

def type() do
  StreamData.one_of([StreamData.integer(), StreamData.binary()])
end

Please report this bug at: https://github.com/elixir-lang/elixir/issues

        (elixir 1.20.0-dev) lib/module/types/descr.ex:4561: Module.Types.Descr.bdd_to_dnf([], [], [], {{:term, %{bitmap: 2}}, :bdd_top, :bdd_bot})
        (elixir 1.20.0-dev) lib/module/types/descr.ex:1894: Module.Types.Descr.list_bdd_to_pos_dnf/1
        (elixir 1.20.0-dev) lib/module/types/descr.ex:2029: Module.Types.Descr.list_hd_static/1
        (elixir 1.20.0-dev) lib/module/types/descr.ex:2016: Module.Types.Descr.list_hd/1
        (elixir 1.20.0-dev) lib/module/types/expr.ex:96: Module.Types.Expr.of_expr/5
        (elixir 1.20.0-dev) lib/module/types/helpers.ex:491: Module.Types.Helpers.zip_map_reduce/5
        (elixir 1.20.0-dev) lib/module/types/expr.ex:716: Module.Types.Expr.apply_one/7
        (elixir 1.20.0-dev) lib/module/types.ex:309: anonymous fn/6 in Module.Types.local_handler/8

Might be able to look into it later, but reporting it for now before I forget 🙂

@josevalim
Copy link
Member Author

@sabiwara i believe it is a cache issue. You need to purge all cache from archives or previous Mix installs. We can also bump the internal chunk version.

@sabiwara
Copy link
Contributor

sabiwara commented Oct 3, 2025

Yeah you're right, sorry for the false warning 🙇

josevalim added a commit that referenced this pull request Oct 4, 2025
We use Lazy BDDS: ternary trees (instead of binary) where the additional node
encodes a lazy union, as in "COVARIANCE AND CONTRAVARIANCE:
A FRESH LOOK AT AN OLD ISSUE", with some additional optimisations
for intersections and differences to avoid materialising unions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants