Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/elixir/lib/module/types/descr.ex
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ defmodule Module.Types.Descr do

@not_set %{optional: 1}
@term_or_optional Map.put(@term, :optional, 1)
@term_or_dynamic_optional Map.put(@term, :dynamic, %{optional: 1})
@term_or_dynamic_optional Map.put(@term, :dynamic, @term_or_optional)
@not_atom_or_optional Map.delete(@term_or_optional, :atom)

@empty_intersection [0, :bdd_bot]
Expand Down
6 changes: 6 additions & 0 deletions lib/elixir/test/elixir/module/types/descr_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,12 @@ defmodule Module.Types.DescrTest do
refute subtype?(if_set(term()), term())
assert subtype?(if_set(term()), if_set(term()))
refute subtype?(if_set(term()), if_set(dynamic(term())))

# Test that union+dynamic optimizations preserves properties
t = opt_union(term(), dynamic(not_set()))
assert subtype?(term(), t)
assert subtype?(dynamic(), t)
assert subtype?(dynamic(integer()), t)
end

test "list" do
Expand Down
Loading