Skip to content

Commit 063a673

Browse files
committed
Check for term_type?(dynamic) before computing difference
1 parent c6ed523 commit 063a673

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/elixir/lib/module/types/descr.ex

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,13 @@ defmodule Module.Types.Descr do
537537
{:term, static, []}
538538

539539
{dynamic, static} ->
540-
# Denormalize functions before we do the difference
541-
{static, dynamic, extra} = fun_denormalize(static, dynamic, opts)
542-
{difference(dynamic, static), static, extra}
540+
if term_type?(dynamic) do
541+
{:term, static, []}
542+
else
543+
# Denormalize functions before we do the difference
544+
{static, dynamic, extra} = fun_denormalize(static, dynamic, opts)
545+
{difference(dynamic, static), static, extra}
546+
end
543547
end
544548

545549
# Merge empty list and list together if they both exist
@@ -2095,7 +2099,10 @@ defmodule Module.Types.Descr do
20952099
descr == %{} ->
20962100
[]
20972101

2098-
term_type?(descr) ->
2102+
# We check for :term literally instead of using term_type?
2103+
# because we check for term_type? in to_quoted before we
2104+
# compute the difference(dynamic, static).
2105+
descr == :term ->
20992106
[{:dynamic, [], []}]
21002107

21012108
single = indivisible_bitmap(descr, opts) ->

0 commit comments

Comments
 (0)